Skip to content

git-mirage: keep error message around#647

Merged
dinosaure merged 1 commit intomirage:mainfrom
reynir:main
Jan 2, 2025
Merged

git-mirage: keep error message around#647
dinosaure merged 1 commit intomirage:mainfrom
reynir:main

Conversation

@reynir
Copy link
Copy Markdown
Member

@reynir reynir commented Dec 18, 2024

This way we can report a better error to the user.

Without this patch I get this error in git-kv/app/mgit.exe:

Fatal error: exception Invalid_argument("error fetching: Handshake got an error")

This error message is fairly unhelpful. The remote URL seems to be fine, my internet connection works fine. What is the actual error?!

With this patch:

Fatal error: exception Invalid_argument("error fetching: Handshake got an error: git-paf: The default generator is not yet initialized. \nTo initialize the RNG with a default generator, and set up entropy collection and periodic reseeding as a background task, do the following:\n  If you are using MirageOS, use the random device in config.ml: `let main = Mirage.main \"Unikernel.Main\" (random @-> job)`, and `let () = register \"my_unikernel\" [main $ default_random]`. \n  If you are using Lwt, execute `Mirage_crypto_rng_lwt.initialize (module Mirage_crypto_rng.Fortuna)` at startup. \n  If you are using Async, execute `Mirage_crypto_rng_async.initialize (module Mirage_crypto_rng.Fortuna)` at startup. \n  If you are using Eio, execute in one of the fibers `Mirage_crypto_rng_eio.run (module Fortuna) env` (`env` from `Eio_main.run`).\n   \n  Otherwise, there is no periodic reseeding. For an initial seed from getrandom(), execute `Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)`. You can use `Mirage_crypto_rng.accumulate` and `Mirage_crypto_rng.reseed` to reseed the RNG manually.")

Aha! The error was not in the handshake at all! This is actionable for me (expect a pull request in git-kv soon).

This way we can report a better error to the user.
@dinosaure dinosaure merged commit 64b989b into mirage:main Jan 2, 2025
@reynir reynir deleted the main branch January 3, 2025 14:00
dinosaure added a commit to dinosaure/opam-repository that referenced this pull request Feb 17, 2025
CHANGES:

- Show error message when the HTTP/Git handshake has an error (@reynir, mirage/ocaml-git#647)
- Add `x-maintenance-intent` (@hannesm, mirage/ocaml-git#648)
- De-functorize `ocaml-git` (@hannesm, mirage/ocaml-git#650)
dinosaure added a commit to dinosaure/opam-repository that referenced this pull request Feb 18, 2025
CHANGES:

- Show error message when the HTTP/Git handshake has an error (@reynir, mirage/ocaml-git#647)
- Add `x-maintenance-intent` (@hannesm, mirage/ocaml-git#648)
- De-functorize `ocaml-git` (@hannesm, mirage/ocaml-git#650)
- Use the last version of `paf` (@dinosaure, mirage/ocaml-git#651)
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

Successfully merging this pull request may close these issues.

2 participants