@iotize/device-com-ble.cordova
Version:
Bluetooth Low Energy (BLE) for IoTize modules Plugin
36 lines • 2.1 kB
JavaScript
import { CodeError } from '@iotize/common/error';
export class CordovaBLEError extends CodeError {
static invalidErrorResult(errObject) {
return new CordovaBLEError(`Internal error: ble cordova plugin returned an unexpected error object`, CordovaBLEError.Code.InternalError);
}
static invalidErrorCode(errObject) {
return new CordovaBLEError(`Internal error: ble cordova plugin returned an invalid error code ${errObject.code} with message ${errObject.message}`, CordovaBLEError.Code.InternalError);
}
static invalidNativeCallResult(result, cause) {
return new CordovaBLEError(`Internal error: native call returned an invalid data type. ${cause.message}`, CordovaBLEError.Code.InternalError);
}
static isValidErrorCode(code) {
return code in CordovaBLEError.Code;
}
static iotizeBLEMissing() {
return new CordovaBLEError(`iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?`, CordovaBLEError.Code.InternalError);
}
}
/* istanbul ignore next */
(function (CordovaBLEError) {
let Code;
(function (Code) {
Code["InternalError"] = "CordovaBLEErrorInternalError";
Code["IllegalArgument"] = "CordovaBLEErrorIllegalArgument";
Code["BLENotAvailable"] = "CordovaBLEErrorBLENotAvailable";
Code["InvalidMacAddress"] = "InvalidMacAddressInvalidMacAddress";
Code["ConnectionError"] = "CordovaBLEErrorConnectionError";
Code["RequestError"] = "CordovaBLEErrorRequestError";
Code["LocationServiceDisabled"] = "CordovaBLEErrorLocationServiceDisabled";
Code["DisconnectError"] = "CordovaBLEErrorDisconnectError";
Code["IllegalAction"] = "CordovaBLEErrorIllegalAction";
Code["NotConnectedError"] = "CordovaBLEErrorNotConnectedError";
Code["StatusCodeError"] = "CordovaBLEErrorStatusCodeError";
})(Code = CordovaBLEError.Code || (CordovaBLEError.Code = {}));
})(CordovaBLEError || (CordovaBLEError = {}));
//# sourceMappingURL=cordova-ble-error.js.map