OCaml bindings to the Peertube ActivityPub video sharing API
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Error handling for PeerTube CLI.
7
8 This module provides utilities for handling errors and managing
9 exit codes in the CLI. *)
10
11(** {1 Exit Codes} *)
12
13(** Exception for CLI exit codes. *)
14exception Exit_code of int
15
16(** {1 Error Handling} *)
17
18(** [handle_exn exn] handles an exception and returns an exit code.
19 Prints formatted error messages for known error types. *)
20val handle_exn : exn -> int
21
22(** [wrap f] wraps a function to handle errors and return exit codes.
23 Catches exceptions and converts them to appropriate exit codes. *)
24val wrap : (unit -> int) -> int
25
26(** {1 Error Reporting} *)
27
28(** [exit_with code] raises [Exit_code code]. *)
29val exit_with : int -> 'a
30
31(** [fail msg] prints an error message and exits with code 1. *)
32val fail : string -> 'a