tmcgilchrist / ocaml-gitlab

Native OCaml bindings to Gitlab REST API v4
https://tmcgilchrist.github.io/ocaml-gitlab/gitlab/
BSD 3-Clause "New" or "Revised" License
27 stars 8 forks source link

Exposing exception `Gitlab.Message` #82

Closed arvidj closed 1 year ago

arvidj commented 1 year ago

I've had a script throw:

Fatal error: exception Gitlab_core.Make(Env)(Time)(CL).Message(324098644, _)

This seems to happen when accessing a private resource without providing a private token. Indeed, by modifying ocaml-gitlab, I could pretty print the exception to:

Fatal error: exception Status_code: 401 (401 Unauthorized)
Message: 401 Unauthorized

However, this was only possible by changing gitlab_s.mli to expose the exception. Perhaps this exception should be exposed to the user? I can make a PR if it makes sense.

tmcgilchrist commented 1 year ago

@arvidj A PR for that would be very helpful.

arvidj commented 1 year ago

@arvidj A PR for that would be very helpful.

See https://github.com/tmcgilchrist/ocaml-gitlab/pull/85/