Created
November 27, 2020 14:28
-
-
Save the-frey/bf2de12086bb09141b2fe27c7e5317e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Entity { | |
| entityType: EntityType; | |
| entity: any | any[]; // ok this will aspirationally be an actual entity map when we can enumerate every single one in all the different namespaces | |
| } | |
| // although the error code implies http status, could also | |
| // be exitcode | |
| // | |
| // if you're paying attention you'll notice that this is | |
| // essentially equivalent to the existing reponse type | |
| // when it returns an error code in the 4xx or 5xx range | |
| // this eliminates the need for lower-level Either fns to have | |
| // knowledge of the Response type. | |
| // although statusCode could be made optional, it's relied on | |
| // by http returning functions, so probably include one to be on the | |
| // safe side. | |
| // or, like, so the code compiles :) | |
| // | |
| // then any code that recieves this error object can either decide | |
| // what to do with it, or call the toResponse helper fns and return to | |
| // the client - which is more likely, as we're a webapp | |
| // in business logic you can infer that if you recieve a | |
| // CooperateError at all then the preceding op has not been | |
| // successful. Perhaps that is enough to know - who can say? | |
| interface Error { | |
| statusCode: number; | |
| errorType: ErrorType; | |
| errorMessage: string; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment