-
Notifications
You must be signed in to change notification settings - Fork 359
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
Rework download failures for better error reporting #6107
base: master
Are you sure you want to change the base?
Conversation
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.
apart from the one suggestion, the design looks great
adf6faf
to
43a9811
Compare
Trimmed up, and undrafted. Some tests changes, still not ideal but there should be no loss of information. |
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.
LGTM as a first step
43a9811
to
6790fc5
Compare
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'd recommend to avoid opens.
They make the codebase harder to maintain, read and reason about.
940defc
to
272d3c8
Compare
272d3c8
to
3b00f24
Compare
@@ -583,7 +583,7 @@ The following actions will be performed: | |||
got md5=hash | |||
[ERROR] Failed to get extra source "i-am-a-patch" of multiple-md5.1: Checksum mismatch | |||
|
|||
OpamSolution.Fetch_fail("Checksum mismatch") | |||
Checksum mismatch |
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 message feels redundant with the ones above
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.
In what way ? The lack of information should be the object of a patch for checksum related errors.
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.
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] multiple-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch:
expected md5=hash
got md5=hash
[ERROR] Failed to get extra source "i-am-a-patch" of multiple-md5.1: Checksum mismatch
Checksum mismatch
"checksum mismatch" is displayed three times one after the other.
I believe the difference is that both errors above are displayed as the error happens and the last one is displayed when the actions finished.
Since this PR is no longer just an API improvement, i think it would be nicer to make it so that such redundant error messages are squashed into one
@@ -230,6 +230,8 @@ let display_error (n, error) = | |||
| Sys.Break | OpamParallel.Aborted -> () | |||
| Failure s -> disp "%s" s | |||
| OpamSystem.Process_error e -> disp "%s" (OpamProcess.string_of_result e) | |||
| Fetch_fail failure -> | |||
disp "%s" (get_dl_failure_reason failure).long_reason | |||
| e -> | |||
disp "%s" (Printexc.to_string e); | |||
if OpamConsole.debug () then |
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 can't find out why, but it appears that OpamConsole.header_error
does not actually display the header like it should in the reftests. This is why some errors seem to appear without context.
I found a case where this change makes the error considerably less descriptive: # On opam 2.2.1
$ opam repository add example http://example.com
[ERROR] Could not update repository "example": OpamDownload.Download_fail(_, "curl: code 404 while downloading http://example.com/index.tar.gz")
[ERROR] Initial repository fetch failed
# On this branch
$ dune exec src/client/opamMain.exe -- repository add example http://example.com
[ERROR] Could not update repository "example": OpamDownload.Download_fail(_)
[ERROR] Initial repository fetch failed I believe the issue arises because of the use of |
Early WIP for eventual discussions.
General wishlist so far: