{"ScriptPreparationCode":"var ERRORS = {\r\n 400: \u0027Bad Request\u0027,\r\n 401: \u0027Unauthorized\u0027,\r\n 403: \u0027Forbidden\u0027,\r\n 404: \u0027Not Found\u0027,\r\n};\r\n\r\nvar serverResponse = {\r\n error: 404,\r\n};","TestCases":[{"Name":"If Lookup","Code":"function mappingError (response) {\r\n let errorCode = 400;\r\n \r\n if (response \u0026\u0026 response.error \u0026\u0026 ERRORS[response.error]) {\r\n \terrorCode = response.error;\r\n }\r\n \r\n return ERRORS[errorCode];\r\n}\r\n\r\nmappingError(serverResponse);","IsDeferred":false},{"Name":"Switch Lookup","Code":"function switchError (response) {\r\n switch (response.error) {\r\n case 400:\r\n return ERRORS[400];\r\n case 401:\r\n return ERRORS[401];\r\n case 402:\r\n return ERRORS[402];\r\n case 404:\r\n return ERRORS[404];\r\n default:\r\n return ERRORS[400];\r\n }\r\n}\r\n\r\nswitchError(serverResponse);","IsDeferred":false}]}