bare-bluetooth-android
Advanced tools
| module.exports = class BluetoothError extends Error { | ||
| constructor(msg, fn = BluetoothError, code = fn.name) { | ||
| super(`${code}: ${msg}`) | ||
| this.code = code | ||
| if (Error.captureStackTrace) { | ||
| Error.captureStackTrace(this, fn) | ||
| } | ||
| } | ||
| get name() { | ||
| return 'BluetoothError' | ||
| } | ||
| static ADVERTISE_FAILED(msg) { | ||
| return new BluetoothError(msg, BluetoothError.ADVERTISE_FAILED) | ||
| } | ||
| static SCAN_FAILED(msg) { | ||
| return new BluetoothError(msg, BluetoothError.SCAN_FAILED) | ||
| } | ||
| } |
+2
-1
@@ -7,2 +7,3 @@ const EventEmitter = require('bare-events') | ||
| const ScanResult = require('./scan-result') | ||
| const errors = require('./errors') | ||
@@ -128,3 +129,3 @@ const STATES = { | ||
| _onscanfail(errorCode) { | ||
| this.emit('scanFail', errorCode) | ||
| this.emit('error', errors.SCAN_FAILED('Scan failed with error code ' + errorCode)) | ||
| } | ||
@@ -131,0 +132,0 @@ } |
+2
-1
| const EventEmitter = require('bare-events') | ||
| const binding = require('../binding') | ||
| const L2CAPChannel = require('./channel') | ||
| const errors = require('./errors') | ||
@@ -169,3 +170,3 @@ const STATES = { | ||
| _onadvertiseerror(errorCode, error) { | ||
| this.emit('advertiseError', errorCode, error) | ||
| this.emit('error', errors.ADVERTISE_FAILED(error)) | ||
| } | ||
@@ -172,0 +173,0 @@ |
+1
-1
| { | ||
| "name": "bare-bluetooth-android", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "description": "Android Bluetooth bindings for Bare", | ||
@@ -5,0 +5,0 @@ "addon": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4678102
0.01%45
2.27%1338
1.52%