report write errors if sqlite can not be created#13
report write errors if sqlite can not be created#13drewwells wants to merge 1 commit intolibrespeed:masterfrom
Conversation
|
The error was the path I was writing to was read only to the user. The imported library may have a wat to surface the underlying write error. This error was a little vague |
|
@drewwells
|
2fae02a to
7c8cab3
Compare
|
Okay I dug into the library a little bit (asking chatgpt) and came up with this. I wanted to get specific file i/o errors when the config was missing and if the sqlite db was not-writeable. This was the case when I first started using speedtest-rust with my systemd setup DEMOsqlite database is not writeable config file was missing or directory not readable |
7c8cab3 to
86e9ca8
Compare
|
ChatGPT doesn't work very well
|
|
Looks okay to me, I assume people will figure out the directory doesn't exist based on the path being reported in the error. What error message were you expecting? I think full path is helpful to debug missing directories. Especially since config doesn't define a root path so they're subject to relative pathing from dockerfile or systemd. I wouldn't be opposed to adding a |
|
I mean, you don't need to show
As much as possible, the user should not see the error. |
The error messages are not unique across the codebase, so I did not know which line was throwing the error. It's pretty standard to show the line number. The dev logger I use gives me a full stack trace when I log an error.
You want to attempt to create the directory before emitting an error? That shouldn't be hard to add. |
Yes, it's easy. |
86e9ca8 to
08033b8
Compare
|
DEMO |
|
I have an idea bro. |
It's rustfmt and two lines to add filename:linenumber to log messages. Both those are useful, I can figure out how to revert rustfmt if you don't want the formatting changes. |
create parent directory, ignoring errors when doing so
08033b8 to
dbc810d
Compare
|
Updated... |
|
@drewwells |
|
@SudoDios good to merge! |
Resolve relative paths and attempt create before passing to sqlite
#12