-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Loader error message refactor #1439
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1439 +/- ##
==========================================
- Coverage 75.22% 75.20% -0.03%
==========================================
Files 150 150
Lines 10911 10924 +13
==========================================
+ Hits 8208 8215 +7
- Misses 2238 2242 +4
- Partials 465 467 +2
Continue to review full report at Codecov.
|
Please add an issue about the docs error pages in the k6-docs repo |
@na-- , sorry didn't see you've approved it when found that small issue :( here is the k6-docs repo issue grafana/k6-docs#21 |
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.
As mentioned in Slack, I feel the messages are too verbose already and this adds to that, so there's no guarantee it will be read at all :)
But we can always structure and improve it later.
var noSchemeError noSchemeRemoteModuleResolutionError | ||
if errors.As(err, &noSchemeError) { | ||
// TODO maybe try to wrap the original error here as well, without butchering the message | ||
return nil, fmt.Errorf(nothingWorkedLoadedMsg, noSchemeError.moduleSpecifier, noSchemeError.err) |
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'm using the latest golangci-lint
version locally, and this line fails with goerr113 err113: do not define dynamic errors, use wrapped static errors instead
, which is from a new linter in v1.26.0
, and we should probably follow it. :)
I think it might be just a matter of using %w
in the format string, and then we could also remove the Unwrap()
method 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.
As far as I understood it - I will need to define a new error type as I also have other parameters ... I also really wanted this to be a quick fix.
And this whole code probably needs additional error types, but again ... I wanted this to be 5 minutes fix so we stop getting all the module resolution problems.
This particular really long error message is only if you managed to not write the correct filename/url you want to execute, at which point, again, because of us doing schemeless remote module resolution we can have different errors, for things totally unrelated to what you meant to do.
If we didn't I could just write "file something.js wasn't found, if you are using docker ..." or "https://something.com returner error: ..." and be done with it...
No description provided.