* Returns a function which optionally takes arguments to format an error message. * @param code - Identifier for the error. * @param message - Human-readable error message. * @returns Function which optionally takes arguments to format an error message.
(code: string, message: string)
| 50 | * @returns Function which optionally takes arguments to format an error message. |
| 51 | */ |
| 52 | function createError(code: string, message: string) { |
| 53 | return (...args: unknown[]) => { |
| 54 | return { |
| 55 | code, |
| 56 | message: format(message, ...args) |
| 57 | }; |
| 58 | }; |
| 59 | } |
| 60 | |
| 61 | export const STANDARD_ERROR = Type.Object({ |
| 62 | code: Type.String(), |