MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / createError

Function createError

api/src/exam-environment/utils/errors.ts:52–59  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

errors.tsFile · 0.85

Calls 1

formatFunction · 0.90

Tested by

no test coverage detected