INNER CODE UNIT · JavaScript

attachCustomErrorDescription

sisense/graphql2rest · src/errorHandling.js:39

	const attachCustomErrorDescription = (response) => {
		const errorCodePath = config.graphqlErrorCodeObjPath || consts.DEFAULT_ERROR_CODE_PATH;
		const gqlErrorCode = dot.pick(errorCodePath, response);
		if (response && response.errors && response.errors[0] && gqlErrorCode !== undefined) {
			if (errorMap && errorMap.errorCodes && errorMap.errorCodes[gqlErrorCode]) {
				const description = errorMap.errorCodes[gqlErrorCode].errorDescription;
				if (description) {
					response.errors[0].errorDescription = description;
				}
			}
		}
		return response;
	};


	return {
		isError,
		getErrorCode,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…