MCPcopy Create free account
hub / github.com/appium/appium / errorFromMJSONWPStatusCode

Function errorFromMJSONWPStatusCode

packages/base-driver/lib/protocol/errors.ts:1073–1080  ·  view source on GitHub ↗
(code: number, value: string | {message: string} = '')

Source from the content-addressed store, hash-verified

1071 * @return The error that is associated with provided JSONWP status code
1072 */
1073export function errorFromMJSONWPStatusCode(code: number, value: string | {message: string} = ''): ProtocolError {
1074 const ErrorClass = jsonwpErrorCodeMap[code] ?? UnknownError;
1075 mjsonwpLog.debug(`Matched JSONWP error code ${code} to ${ErrorClass.name}`);
1076 // if `value` is an object, pull message from it, otherwise use the plain
1077 // value, or default to an empty string, if null
1078 const message = ((value || {}) as any).message || value || '';
1079 return new ErrorClass(message);
1080}
1081
1082/**
1083 * Retrieve an error derived from W3C JSON Code

Callers 4

asyncHandlerFunction · 0.90
commandMethod · 0.90
errors.spec.tsFile · 0.90
getActualErrorMethod · 0.85

Calls 1

debugMethod · 0.65

Tested by

no test coverage detected