INNER CODE UNIT · JavaScript

isError

sisense/graphql2rest · src/errorHandling.js:10

	const isError = (response) => {
		if (!response.data && response.errors) return true;
		if (response.data && response.errors) {
			let allNull = true;
			if (Object.keys(response.data).length === 0) return true;
			for (const key in response.data) {
				if (response.data[key] !== null && response.data[key] !== undefined) allNull = false;
			}
			if (allNull) return true;
		}
		return false;
	};


	/* Returns corresponding HTTP status code based on the error map, or null if there is no mapping */
	const getErrorCode = (response) => {
		const errorCodePath = config.graphqlErrorCodeObjPath || consts.DEFAULT_ERROR_CODE_PATH;
		if (!response

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…