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

Function createSanitizedError

src/Error.js:13–22  ·  view source on GitHub ↗

* Creates a sanitized error that hides detailed information from clients * while logging the detailed message server-side. * * @param {number} errorCode - The Parse.Error code (e.g., Parse.Error.OPERATION_FORBIDDEN) * @param {string} detailedMessage - The detailed error message to log server-sid

(errorCode, detailedMessage, config, sanitizedMessage = 'Permission denied')

Source from the content-addressed store, hash-verified

11 * @returns {Parse.Error} A Parse.Error with sanitized message
12 */
13function createSanitizedError(errorCode, detailedMessage, config, sanitizedMessage = 'Permission denied') {
14 // On testing we need to add a prefix to the message to allow to find the correct call in the TestUtils.js file
15 if (process.env.TESTING) {
16 defaultLogger.error('Sanitized error:', detailedMessage);
17 } else {
18 defaultLogger.error(detailedMessage);
19 }
20
21 return new Parse.Error(errorCode, config?.enableSanitizedErrorResponse !== false ? sanitizedMessage : detailedMessage);
22}
23
24/**
25 * Creates a sanitized error from a regular Error object

Callers 15

RestWriteFunction · 0.90
RestWrite.jsFile · 0.90
enforceRouteAllowListFunction · 0.90
enforceMasterKeyAccessFunction · 0.90
getUserFromSessionTokenFunction · 0.90
cloudConfigFunction · 0.90
updateCloudConfigFunction · 0.90
loadFunction · 0.90
validatePermissionMethod · 0.90
findMethod · 0.90
handlePostMethod · 0.90
handlePutMethod · 0.90

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected