Documented SieveExceptions (#11)

This commit is contained in:
Biarity 2018-02-15 19:17:14 +10:00 committed by GitHub
parent 54ab424087
commit c324b1eb65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,15 +116,6 @@ Then you can add the configuration:
}
```
## 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
With all the above in place, you can now send a GET request that includes a sort/filter/page query.
@ -171,6 +162,18 @@ You can replace this DSL with your own (eg. use JSON instead) by implementing an
| `_=*` | Case-insensitive string Starts with |
| `==*` | Case-insensitive string Equals |
### Handle Sieve's exceptions
Sieve will silently fail unless `ThrowExceptions` in the configuration is set to true. 3 kinds of custom exceptions can be thrown:
* `SieveMethodNotFoundException` with a `MethodName`
* `SieveIncompatibleMethodException` with a `MethodName`, an `ExpectedType` and an `ActualType`
* `SieveException` which encapsulates any other exception types in its `InnerException`
It is recommended that you write exception-handling middleware to globally handle Sieve's exceptions when using it with ASP.NET Core.
### Example project
You can find an example project incorporating most Sieve concepts in [SieveTests](https://github.com/Biarity/Sieve/tree/master/SieveTests).