Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error handling for NodeBasedHandler #94

Open
pixtron opened this issue Nov 13, 2018 · 1 comment
Open

Improved error handling for NodeBasedHandler #94

pixtron opened this issue Nov 13, 2018 · 1 comment
Assignees

Comments

@pixtron
Copy link

pixtron commented Nov 13, 2018

Expected Behavior

It would be usefull, if ON_UNABLE_TO_START errors would be bubbled up to the app, so it can react accordingly.
Ideally, NodeBasedHandler.performAuthorizationRequest would return a promise, which is resolved as soon as the server is started and the consent screen has been opened.

Also it would be usefull if the errors would be of class AppAuthError, with a unique code.

Describe the problem

Actual Behavior

Errors during notifier server startup are only logged and can't be caught in a clean way.

Steps to reproduce the behavior

.then(() => {
server = Http.createServer(requestHandler);
server.listen(this.httpServerPort);
const url = this.buildRequestUrl(configuration, request);
log('Making a request to ', request, url);
opener(url);
})
.catch((error) => {
log('Something bad happened ', error);
emitter.emit(ServerEventsEmitter.ON_UNABLE_TO_START);
});

1.) Add a line throw new Error('Some error occured'); above server = Http.createServer(requestHandler);
2.) Start the example electron app (see googlesamples/appauth-js-electron-sample/pull/3 with update to appauth v1.1.1)
3.) Click "Sign in"

Results in:

Uncaught (in promise) Unable to create HTTP server at port 8000

Environment

  • AppAuth-JS version: 1.1.1
  • AppAuth-JS Environment : Node/Electron
@tikurahul
Copy link
Collaborator

Thanks for the report. I will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants