Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refine error output if ErrorResponse received #279

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

Dhghomon
Copy link
Contributor

@Dhghomon Dhghomon commented Sep 26, 2023

Looks like the resolution to this issue geldata/gel-cli#1125 is inside edgedb-rust (and edgedb itself).

This PR essentially changes this:

[2023-09-26T02:24:30Z WARN edgedb_tokio::raw::connection] Error received from server: database 'edgedbb' does not exist. Severity: Error. Code: 67305477[2023-09-26T02:24:30Z DEBUG edgedb_tokio::raw::connection] Error details: {257: b"Traceback (most recent call last):\n File "edb/server/dbview/dbview.pyx", line 1182, in edb.server.dbview.dbview.DatabaseIndex.get_db\nKeyError: 'edgedbb'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "edb/server/protocol/frontend.pyx", line 294, in edb.server.protocol.frontend.FrontendConnection.main\n File "edb/server/protocol/binary.pyx", line 1022, in authenticate\n File "edb/server/protocol/binary.pyx", line 292, in auth\n File "edb/server/protocol/binary.pyx", line 385, in _start_connection\n File "/home/edgedb/.local/share/edgedb/portable/3.3/lib/python3.11/site-packages/edb/server/server.py", line 621, in new_dbview\n db = self.get_db(dbname=dbname)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/home/edgedb/.local/share/edgedb/portable/3.3/lib/python3.11/site-packages/edb/server/server.py", line 614, in get_db\n return self._dbindex.get_db(dbname)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "edb/server/dbview/dbview.pyx", line 1184, in edb.server.dbview.dbview.DatabaseIndex.get_db\nedb.errors.UnknownDatabaseError: database 'edgedbb' does not exist\n"}

to this:

[2023-09-26T03:09:16Z WARN edgedb_tokio::raw::connection] Error received from server: database 'edgedbb' does not exist. Severity: Error. Code: 0x4030005

But also displays the extra output if RUST_LOG is set to at least debug.

The other part adding "please specify another one" that @1st1 mentions looks to be from here in the Python code: https://github.com/edgedb/edgedb/blob/23a7cd0f2db8d66addb0cd38950c85268f585742/edb/server/dbview/dbview.pyx#L1194 So maybe @msullivan might want to add that?

On a related point, when the CLI starts up it calls this log_levels::init() function here https://github.com/edgedb/edgedb-cli/blob/master/src/main.rs#L122 that does some pretty precise changes to the log levels depending on which command is being used and whether it's --verbose or not, so when I make a change to the CLI I always comment it out and set RUST_LOG to trace. It could be nice to make a flag to do this so everyday EdgeDB users and Rust users that don't feel like building the CLI just to see more debug output could set the log level to try to find out themselves what went wrong. Any reason not to add that flag in a different PR?

@Dhghomon Dhghomon marked this pull request as ready for review September 26, 2023 03:35
@raddevon
Copy link
Contributor

LGTM, but I will let someone who can apply more rigor to the Rust code do a proper review.

@Dhghomon Dhghomon merged commit 6345ea3 into master Oct 2, 2023
@Dhghomon Dhghomon deleted the cleaner-error-messages branch February 9, 2024 01:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants