MCPcopy Index your code
hub / github.com/parse-community/parse-server / createSanitizedHttpError

Function createSanitizedHttpError

src/Error.js:32–44  ·  view source on GitHub ↗

* Creates a sanitized error from a regular Error object * Used for non-Parse.Error errors (e.g., Express errors) * * @param {number} statusCode - HTTP status code (e.g., 403) * @param {string} detailedMessage - The detailed error message to log server-side * @returns {Error} An Error with sanit

(statusCode, detailedMessage, config)

Source from the content-addressed store, hash-verified

30 * @returns {Error} An Error with sanitized message
31 */
32function createSanitizedHttpError(statusCode, detailedMessage, config) {
33 // On testing we need to add a prefix to the message to allow to find the correct call in the TestUtils.js file
34 if (process.env.TESTING) {
35 defaultLogger.error('Sanitized error:', detailedMessage);
36 } else {
37 defaultLogger.error(detailedMessage);
38 }
39
40 const error = new Error();
41 error.status = statusCode;
42 error.message = config?.enableSanitizedErrorResponse !== false ? 'Permission denied' : detailedMessage;
43 return error;
44}
45
46export { createSanitizedError, createSanitizedHttpError };

Callers 7

enforceMasterKeyAccessFunction · 0.90
getHandlerMethod · 0.90
createHandlerMethod · 0.90
deleteHandlerMethod · 0.90
Utils.spec.jsFile · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected