README.md in salestation-3.8.1 vs README.md in salestation-3.9.0

- old
+ new

@@ -73,9 +73,31 @@ include Salestation::Web.new(errors: { CustomError => -> (error) { CustomResponse.new(error) } }) ``` +### Providing custom error fields + +If you need to specify additional error fields you can use `from` method. +`from` accepts base error on which the rest of the response is built. +Base error must be a hash or implement `to_h` method. + +Example: + +``` +App::Errors::Conflict.from({details: 'details'}, message: 'message', debug_message: 'debug_message') +``` + +Response: + +```javascript +{ + "details": "details", + "message": "message", + "debug_message": "debug_message" +} +``` + ### Using Extractors Salestation provides extractors to fetch parameters from the request and pass them to the chain. Available extractors are `BodyParamExtractor`, `QueryParamExtractor`, `ConstantInput`, `HeadersExtractor`. Multiple extractors can be merged together. If two or more extractors use the same key, the value will be from the last extractor in the merge chain.