My agentic slop goes here. Not intended for anyone else!
at main 2.6 kB view raw
1(** JMAP Error Types and Exception Handling *) 2 3(** Error classification level *) 4type error_level = 5 | Request_level (** HTTP 4xx/5xx errors before request processing *) 6 | Method_level (** Method execution errors *) 7 | Set_level (** Object-level errors in /set operations *) 8 9(** Request-level errors (RFC 8620 Section 3.6.1) *) 10type request_error = 11 | Unknown_capability of string 12 | Not_json 13 | Not_request 14 | Limit of string 15 16(** Method-level errors (RFC 8620 Section 3.6.2) *) 17type method_error = 18 | Server_unavailable 19 | Server_fail of string option 20 | Server_partial_fail 21 | Unknown_method 22 | Invalid_arguments of string option 23 | Invalid_result_reference 24 | Forbidden 25 | Account_not_found 26 | Account_not_supported_by_method 27 | Account_read_only 28 | Request_too_large 29 | State_mismatch 30 | Cannot_calculate_changes 31 | Anchor_not_found 32 | Unsupported_sort 33 | Unsupported_filter 34 | Too_many_changes 35 | From_account_not_found 36 | From_account_not_supported_by_method 37 38(** Set-level errors (RFC 8620 Section 5.3) *) 39type set_error_type = 40 | Forbidden 41 | Over_quota 42 | Too_large 43 | Rate_limit 44 | Not_found 45 | Invalid_patch 46 | Will_destroy 47 | Invalid_properties 48 | Singleton 49 | Already_exists 50 | Mailbox_has_child 51 | Mailbox_has_email 52 | Blob_not_found 53 | Too_many_keywords 54 | Too_many_mailboxes 55 | Invalid_email 56 | Too_many_recipients 57 | No_recipients 58 | Invalid_recipients 59 | Forbidden_mail_from 60 | Forbidden_from 61 | Forbidden_to_send 62 | Cannot_unsend 63 64(** SetError detail with optional fields *) 65type set_error_detail = { 66 error_type : set_error_type; 67 description : string option; 68 properties : string list option; 69 existing_id : string option; 70 not_found : string list option; 71 max_recipients : int option; 72 invalid_recipients : string list option; 73} 74 75(** Main JMAP exception type *) 76exception Jmap_error of error_level * string * string option 77 78(** Parse error for JSON parsing failures *) 79exception Parse_error of string 80 81(** Helper constructors for exceptions *) 82val request_error : request_error -> exn 83val method_error : method_error -> exn 84val set_error : set_error_detail -> exn 85val parse_error : string -> exn 86 87(** Convert error types to strings for serialization *) 88val request_error_to_string : request_error -> string 89val method_error_to_string : method_error -> string 90val set_error_type_to_string : set_error_type -> string 91val set_error_type_of_string : string -> set_error_type 92 93(** Parse set_error_detail from JSON *) 94val parse_set_error_detail : Ezjsonm.value -> set_error_detail