MCPcopy Index your code
hub / github.com/meetDeveloper/freeDictionaryAPI / handleError

Function handleError

app.js:46–63  ·  view source on GitHub ↗
(error = {})

Source from the content-addressed store, hash-verified

44
45
46function handleError (error = {}) {
47 // Using duck typing to know if we explicitly threw this error
48 // If not then wrapping original error into UnexpectedError
49 if (!error.requestType) { error = new errors.UnexpectedError({ original_error: error }); }
50
51 const { requestType, title, message, resolution } = error;
52 status = REQUEST_TYPE_STATUS_CODE[requestType],
53 body = JSON.stringify({
54 title,
55 message,
56 resolution
57 });
58
59 this.set(HEADER_CONTENT_TYPE, 'application/json');
60 this.set(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, '*');
61
62 return this.status(status).send(body);
63};
64
65app.set('trust proxy', true);
66

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected