Skip to content

Improve error handling #2

Description

@geovie

Currently we only log error in the noble-winrt package as noble has a rather bad error handling story (noble/noble#830). The problem is that it only emits a warning if e.g. a peripheral is not found and there is no way for bindings to return an error.

A proper solution would be to add a error argument in the bindings interface and the noble interface to let bindings error bubble up to the user.

Noble.prototype.onDisconnect = function(peripheralUuid, error) {
  var peripheral = this._peripherals[peripheralUuid];
  if (peripheral) {
    peripheral.emit('disconnect', error);
  } else {
    this.emit('warning', 'unknown peripheral ' + peripheralUuid + ' disconnected!');
  }
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions