-
Notifications
You must be signed in to change notification settings - Fork 16
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
improve shell error handling #330
Conversation
FE-4795 see above jira for more details 1. shell will not exit on errors 2. shell will correctly reconnect to core in the presence of an intermittent connection error
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.
I get some compile errors:
src/commands/endpoint/add.ts:123:20 - error TS2339: Property 'close' does not exist on type 'FaunaClient'.
123 await client.close();
~~~~~
and my shell crashes after eval:
Error: client.close is not a function
at Object.error (/home/macmv/Desktop/programming/fauna/fauna-shell/node_modules/@oclif/core/lib/errors/index.js:27:15)
at EvalCommand.error (/home/macmv/Desktop/programming/fauna/fauna-shell/node_modules/@oclif/core/lib/command.js:139:23)
at EvalCommand.error (/home/macmv/Desktop/programming/fauna/fauna-shell/src/lib/fauna-command.js:49:11)
at EvalCommand.run (/home/macmv/Desktop/programming/fauna/fauna-shell/src/commands/eval.js:115:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async EvalCommand._run (/home/macmv/Desktop/programming/fauna/fauna-shell/node_modules/@oclif/core/lib/command.js:117:22)
at async Config.runCommand (/home/macmv/Desktop/programming/fauna/fauna-shell/node_modules/@oclif/core/lib/config/config.js:329:25)
at async Object.run (/home/macmv/Desktop/programming/fauna/fauna-shell/node_modules/@oclif/core/lib/main.js:89:16)
src/lib/fauna-client.ts
Outdated
body: { | ||
data: json.data as T, | ||
}, |
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 should just be
body: { | |
data: json.data as T, | |
}, | |
body: json, |
so that the summary
field gets copied over. for example, try this: fauna eval "log('hi')"
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.
o I see, thats why the summary field was shared across error and success types
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.
yeah. you can also get log messages back in the summary
for runtime errors too:
log("hi"); 1/0
// returns
divide_by_zero: Attempted integer division by zero.
error: Attempted integer division by zero.
at *query*:1:14
|
1 | log('hi'); 1/0
| ^
|
info at *query*:1: hi
authorization: `Bearer ${secret ?? this.secret}`, | ||
"x-fauna-source": "Fauna Shell", | ||
...(typecheck !== undefined && { "x-typecheck": typecheck.toString() }), | ||
...(format !== undefined && { "x-format": format }), |
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.
the x-query-timeout-ms
header should be sent here
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.
good call, looks like we also weren't correctly passing the timeout to the client so resolving that as well.
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.
oh cool, nice
yeah my bad, doing my pre commit cleanup I thought I had just removed the old commented out query method but turns out I also removed the non commented out close method. |
FE-4795
see above jira for more details
j