Skip to content
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 "file not found" error messages #2180

Open
szokeasaurusrex opened this issue Oct 9, 2024 · 1 comment
Open

Improve "file not found" error messages #2180

szokeasaurusrex opened this issue Oct 9, 2024 · 1 comment
Assignees

Comments

@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Oct 9, 2024

Currently, we have some "file not found" error messages, which are not super helpful, because they don't mention the file path that Sentry CLI was looking for.

We should add the file path to these error messages, to make them more actionable for users.

Ideally, whenever we attempt to open a file, we would add context to the error message which includes the name of the file we are trying to open, and perhaps some additional information about the context in which we are opening the file. For instance, if we are trying to open a sourcemap file at /path/to/sourcemap.map, we could make the error message something like the following:

Error while opening sourcemap `/path/to/sourcemap.map`: File not found

Exact format could look different, but we should aim to include this information in the error messages to make them more user-friendly.

@szokeasaurusrex
Copy link
Member Author

As of right now, it is quite difficult to trace through code to determine where "file not found" error messages are even coming from. This is because the string "file not found" does not appear in code, indicating the error likely comes from some dependency.

While trying to trace through and see what functions can fail, I noticed that we have several functions that cannot ever error, but which still return a Result. The existence of these functions makes it difficult to see what can actually fail in the code. Fortunately, we can enable the unnecessary_wraps Clippy lint to find these functions. Before trying to improve the file not found error messages, it likely makes sense to enable this lint to make it easier for us to find where the file not found errors might occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant