surrealdb / surrealdb.js

SurrealDB SDK for JavaScript
https://surrealdb.com
Apache License 2.0
293 stars 48 forks source link

Bug: new ResponseError("message") consumes the message #286

Open LucyEgan opened 3 months ago

LucyEgan commented 3 months ago

Describe the bug

When a error has been created with new ResponseError("message"), the message is removed in the stack trace, and only accessible via .message compared to normally when a Error is .toString()ed

Steps to reproduce

console.error('Something broke', error); << where error is of the type ResponseError

console.error('Something broke', new ResponseError('some database error'));

^^ above returns

Something broke ResponseError
    at <anonymous>:1:34

Expected behaviour

Something broke ResponseError: some database error
    at <anonymous>:1:34

SurrealDB version

2.0.0-alpha.2 for linux on x86_64

SurrealDB.js version

1.0.0-beta.9

Contact Details

lucy.e@aspirecomps.co.uk

Is there an existing issue for this?

Code of Conduct