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

Better error msgs #18

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Better error msgs #18

wants to merge 8 commits into from

Conversation

rand00
Copy link

@rand00 rand00 commented Nov 14, 2022

No description provided.

last := (last_date, Result.get_ok last_hash)
Store.digest store Mirage_kv.Key.empty >>= function
| Error (`Not_found _) ->
let msg = Fmt.str "No commit found - are you on the correct branch?" in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's indeed a good way (we probably should print out which branch we want to clone).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which branch are you thinking about? My thinking was that the user knows what branch is passed, and multiple possible branches can be present - so I wouldn't know what branch to suggest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the remote used by git-kv you can optionally specify a branch. It seems git-kv doesn't have a function to get the branch used - it may not be obvious what the default branch is, and I believe it changed from master to main a few months back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, on Debian, the default branch still is master and we currently occur several cases where people don't really understand this kind of failure. I will try to provide an accessor on git-kv to get the branch used.

@hannesm
Copy link
Collaborator

hannesm commented Mar 24, 2023

Thanks for your PR. I agree that the branch that was cloned could be part of the "better error msgs".

But I've an issue with a failwith that may happen at any point in time (whenever the update-hook is invoked) -- leading to the unikernel exiting.

Could we instead have such an exceptional failure only when at startup the remote is not reachable / cloned an empty repository, please? I agree that the current behavour (Result.get_ok last_hash) is as well leading to termination, so we should improve on that front.

So what is the desired semantics?

  • on startup, if the remote git repo (+branch) is empty, terminate
  • in the middle of the run, when update is invoked, log an error when the git repo or branch disappeared (at the moment, an internal server error is reported to the client doing the update, with the error from the git clone)

Any other ideas?

@rand00
Copy link
Author

rand00 commented Mar 28, 2023

Now retrieve_last_commit returns a Lwt_result.t, which can be handled as needed on callsite.

Instead of handling this error differently from others, I made all internal server errors in dispatch log error msg instead

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

Successfully merging this pull request may close these issues.

4 participants