solid-client-authn-js icon indicating copy to clipboard operation
solid-client-authn-js copied to clipboard

Session.onError not in types for [email protected]

Open davidboweninrupt opened this issue 3 years ago • 2 comments

Search terms you've used

I looked at every one of the 44 existing issues and this is the only similar one but it appears quite different

Impacted package

Which packages do you think might be impacted by the bug ?

  • [ ] solid-client-authn-browser
  • [x] solid-client-authn-node
  • [ ] solid-client-authn-core
  • [ ] oidc-client-ext
  • [ ] Other (please specify): ...

Bug description

I see lots of other methods reflected in the types in Visual Studio Code, but onError isn't available.

I see the method referenced in the docs.

To Reproduce

  1. Install [email protected] into a project you have loaded into Visual Studio Code
  2. Create a Session object and then make a call to the onError method:
import { Session } from "@inrupt/solid-client-authn-node";
const session = new Session()
session.onError(console.error)

Expected result

  • Visual Studio Code should find it in the types and no error should be shown
  • The code should compile

Actual result

  • Visual Studio Code does not find it in the types and reports the problem with a red squiggly line. image

image

  • The code does not compile image

Environment

Please run

npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers

in your project folder and paste the output here:

  System:
    OS: Linux 5.14 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
    Memory: 11.57 GB / 31.09 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 16.13.0 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 8.1.0 - /usr/local/bin/npm
  npmPackages:
    @inrupt/solid-client-authn-node: * => 1.11.2 
    @inrupt/solid-client-notifications: * => 0.1.0 
    node-fetch: * => 2.6.1 
    rdflib: * => 2.2.10 
    ts-node: * => 10.4.0 
  npmGlobalPackages:
    eslint: 8.1.0
    tslint-to-eslint-config: 2.10.1
    typescript: 4.4.4

davidboweninrupt avatar Nov 20 '21 23:11 davidboweninrupt

It has been worked on in https://github.com/inrupt/solid-client-authn-js/pull/1556, but a lot happened in between and I never got around to merging it. I'll make sure it gets done soon.

NSeydoux avatar Nov 22 '21 12:11 NSeydoux

The Session instance may emit an error event, events.ERROR from @inrupt/solid-client-authn-core, but as shown in #1556, there's a bunch more needed to improve error handling here. Most likely we'll end up revisiting this with the refactor we're planning (though it's unscheduled at the moment iirc).

ThisIsMissEm avatar Jan 13 '23 00:01 ThisIsMissEm