openid / openid/AppAuth-JS

Improved error handling for NodeBasedHandler

Open
#94 1 comment 0 reactions 1 assignee View on GitHub

@tikurahul is already working on this.

Since Nov 14, 2018.

Dominant language
TypeScript
Stars
1k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

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

https://github.com/openid/AppAuth-JS/blob/6a9c47c9002829142f50ecc887b538216cef5854/src/node_support/node_request_handler.ts#L109-L119

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.