use safer error type check
MODIFY
lib/jsonwp-proxy/proxy.js
lib/jsonwp-proxy/proxy.js
@@ -2,7 +2,7 @@ import _ from 'lodash';
import { logger, util } from 'appium-support';
import request from 'request-promise';
import { getSummaryByCode } from '../jsonwp-status/status';
-import { errors, errorFromMJSONWPStatusCode, errorFromW3CJsonCode } from '../protocol/errors';
+import { errors, isErrorType, errorFromMJSONWPStatusCode, errorFromW3CJsonCode } from '../protocol/errors';
const log = logger.getLogger('JSONWP Proxy');
@@ -161,7 +161,7 @@ class JWProxy {
try {
[response, resBody] = await this.proxy(url, method, body);
} catch (err) {
- if (err instanceof errors.ProxyRequestError) {
+ if (isErrorType(err, errors.ProxyRequestError)) {
throw err.getActualError();
}
throw new errors.UnknownError(err.message);

use safer error type check