docs
docs copied to clipboard
Document some best practices
For example, handling inputs/errors at the start of the handler:
match String::toUUID param
| None -> Http::badRequest "param was not a uuid"
| Some id ->
... // rest of handler
Is there a pattern to avoid "match hell"?
match String::toUUID param_one
| None -> Http::badRequest "param one was not a uuid"
| Some id ->
... // rest of handler
match String::toUUID param_two
| None -> Http::badRequest "param two was not a uuid"
| Some id ->
... // rest of handler
... // etc
match MyCustonTypeSet:: [valA, valB, valC] is [id, string, int]
| None -> Http::badRequest "Error I"
| Some -> Http::badRequest "Error II"
| All ->
... // rest of handler
Is there a pattern to avoid "match hell"?
When we add tuples there will be, but there isn't right now.