mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-22 05:22:57 +01:00
Added docs for optional exception handling (#7)
This commit is contained in:
parent
e83f647945
commit
9ce841b880
21
README.md
21
README.md
@ -100,15 +100,6 @@ public class SieveCustomFilterMethods : ISieveCustomFilterMethods
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Handle Sieve's exceptions
|
|
||||||
|
|
||||||
Sieve can throw 2 kinds of custom exceptions:
|
|
||||||
|
|
||||||
* `SieveMethodNotFoundException` with a `MethodName`
|
|
||||||
* `SieveIncompatibleMethodException` with a `MethodName`, an `ExpectedType` and an `ActualType`
|
|
||||||
|
|
||||||
It is recommended that you write exception-handling middleware to globally handle Sieve's exceptions when using it with ASP.NET Core.
|
|
||||||
|
|
||||||
## Configure Sieve
|
## Configure Sieve
|
||||||
Use the [ASP.NET Core options pattern](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) with `SieveOptions` to tell Sieve where to look for configuration. For example:
|
Use the [ASP.NET Core options pattern](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) with `SieveOptions` to tell Sieve where to look for configuration. For example:
|
||||||
```
|
```
|
||||||
@ -119,11 +110,21 @@ Then you can add the configuration:
|
|||||||
{
|
{
|
||||||
"Sieve": {
|
"Sieve": {
|
||||||
"CaseSensitive": `boolean: should property names be case-sensitive? Defaults to false`,
|
"CaseSensitive": `boolean: should property names be case-sensitive? Defaults to false`,
|
||||||
"DefaultPageSize": `number: optional number to fallback to when no page argument is given`
|
"DefaultPageSize": `number: optional number to fallback to when no page argument is given. Set <=0 to disable paging if no pageSize is specified (default).`,
|
||||||
|
"ThrowExceptions": `boolean: should Sieve throw exceptions instead of silently failing? Defaults to false`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Handle Sieve's exceptions
|
||||||
|
|
||||||
|
Sieve will silently fail unless `ThrowExceptions` in the configuration is set to true. 2 kinds of custom exceptions can be thrown:
|
||||||
|
|
||||||
|
* `SieveMethodNotFoundException` with a `MethodName`
|
||||||
|
* `SieveIncompatibleMethodException` with a `MethodName`, an `ExpectedType` and an `ActualType`
|
||||||
|
|
||||||
|
It is recommended that you write exception-handling middleware to globally handle Sieve's exceptions when using it with ASP.NET Core.
|
||||||
|
|
||||||
## Send a request
|
## Send a request
|
||||||
|
|
||||||
With all the above in place, you can now send a GET request that includes a sort/filter/page query.
|
With all the above in place, you can now send a GET request that includes a sort/filter/page query.
|
||||||
|
Loading…
Reference in New Issue
Block a user