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

Connector reassigns read-only properties of errors #445

Open
sharafian opened this issue Jul 12, 2018 · 0 comments
Open

Connector reassigns read-only properties of errors #445

sharafian opened this issue Jul 12, 2018 · 0 comments

Comments

@sharafian
Copy link

sharafian commented Jul 12, 2018

let err = e
if (!err || typeof err !== 'object') {
err = new Error('non-object thrown. value=' + e)
}
if (!err.ilpErrorCode) {
err.ilpErrorCode = codes.F02_UNREACHABLE
}
err.message = 'failed to send packet: ' + err.message
throw err
}

This code sets the .ilpErrorCode and .message fields of an error thrown from a plugin's sendData. What we're seeing is that this can trigger a new error:

2018-07-12T17:15:49.225Z ilp-protocol-stream:Client:Connection:debug debug test packet 2 was rejected with a F00 error with the message: "Cannot assign to read only property 'message' of object 'UnreachableError: account must be in READY state to receive packets. state=BLOCKED'"

Instead, this catch block should just construct a new error

@sharafian sharafian added the bug label Jul 12, 2018
@adrianhopebailie adrianhopebailie added this to To do in Connector Refactor via automation Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant