Davis
How to set up and use a structured error format?
Hi;
I am not strong in API design, and had a question about structuring error formats.
I wish to create error formats, that are extensions of the
Error
instance, let's all it MY_API_ERROR_INSTANCE
Something like:
But I don't wish to always type this out, and I also want to create a type-safe and generic one, in that it can accommodate different types of responses & statuses.
Has anyone implemented something like this, or has any resources they can share about this kind of API design?
I appreciate the help.
P.S. For context, I am building targeting Cloudflare Workers, Neon, Drizzle... if that helps with some context.3 replies