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

PropertyIsUndefined custom Error appears to be flawed #18

Open
Cafe137 opened this issue Aug 31, 2021 · 0 comments
Open

PropertyIsUndefined custom Error appears to be flawed #18

Cafe137 opened this issue Aug 31, 2021 · 0 comments
Labels

Comments

@Cafe137
Copy link
Contributor

Cafe137 commented Aug 31, 2021

Catching it in synchronous code and logging via console.log(error, error.message, error.trace) yields [class u extends Error] undefined undefined.

The message is undefined, and the minified class name does not help too much either.


Receiving it as an unhandled rejection is a little bit better:

The promise rejected with the reason "class u extends Error{constructor(){super("Property does not exist in the object")}}".

This is still wrong in multiple ways, but at least I could identify the Error.


Lastly, if it worked properly, I think the error message should contain the name of the undefined property, in order to make the message hold useful information.


Code to reproduce:

const { MantarayNode } = require('mantaray-js')

try {
    new MantarayNode().addFork(Buffer.alloc(1), Buffer.alloc(32))
} catch (error) {
    console.log(error, error.message, error.stack)
}

(async () => {
    new MantarayNode().addFork(Buffer.alloc(1), Buffer.alloc(32))
})()
@bee-runner bee-runner bot added the issue label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant