Sucrose v0.1.3 Sucrose.Common
This is the common module to be shared / used amongst the middleware policies.
Link to this section Summary
Functions
This is the default error handler to put when we want to deny something.
Handle the responses, return, warn, or error based upon the response.
Link to this section Functions
Link to this function
handle_censor(check, censor)
Link to this function
handle_error(check, message \\ "Unauthorized")
This is the default error handler to put when we want to deny something.
Link to this function
handle_response(response, check)
Handle the responses, return, warn, or error based upon the response.
true
- return the normal response{:ok, _}
-> return the normal response{:censor, val}
-> censor the value and put the responsefalse
- return null / log warn message:error
- return nil / log warn message{:error, msg}
- return null / log warn message and return themsg
on the payload