-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add warnings handler #1115
Add warnings handler #1115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👑
@@ -1230,7 +1272,7 @@ export class BaseRawConnection { | |||
(!inCodec && args !== null) || | |||
(this.stateCodec === INVALID_CODEC && state !== Session.defaults()) | |||
) { | |||
[card, inCodec, outCodec] = await this._parse( | |||
[card, inCodec, outCodec, _, _, _, warnings] = await this._parse( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I think these _
variable names are unnecessary? Maybe eslint would complain if you did this, but I think this is equivalent:
[card, inCodec, outCodec, _, _, _, warnings] = await this._parse( | |
[card, inCodec, outCodec,,,, warnings] = await this._parse( |
Just a tiny nit, not even something I'm suggesting we do here, just putting it out there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I didn't know you could do that 🌈⭐. Though I think I prefer the underscores as it looks more intentional to me, and not that I've just typoed it.
const error_type = this.constructor as typeof EdgeDBError as any; | ||
return Boolean(error_type.tags?.[tag]); | ||
hasTag(tag: tags): boolean { | ||
const error_type = this.constructor as typeof EdgeDBError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
let warnings: EdgeDBError[] | null = null; | ||
client = client.withWarningHandler((_warnings) => (warnings = _warnings)); | ||
|
||
await expect(client.query("select _warn_on_call();")).resolves.toEqual([0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some kind of built-in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Sully 'documented' it here: edgedb/edgedb#7823. I think it only exists in test mode/dev mode though.
See edgedb/edgedb#7822 for details.