Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

monopam: add error helper functions in verse_registry

Extract error construction into err_io, err_invalid, and err helper
functions for consistent error message formatting.

+9 -3
+9 -3
lib/verse_registry.ml
··· 92 92 93 93 let empty_registry = { name = "opamverse"; description = None; members = [] } 94 94 95 + let err_io exn = 96 + Error (Fmt.str "Registry IO error: %s" (Printexc.to_string exn)) 97 + 98 + let err_invalid msg = Error (Fmt.str "Invalid registry: %s" msg) 99 + let err exn = Error (Fmt.str "Registry error: %s" (Printexc.to_string exn)) 100 + 95 101 let load ~fs path = 96 102 let path_str = Fpath.to_string path in 97 103 Logs.info (fun m -> m "Loading registry from path: %s" path_str); ··· 103 109 with 104 110 | Eio.Io _ as e -> 105 111 Logs.err (fun m -> m "Eio.Io error: %s" (Printexc.to_string e)); 106 - Error (Fmt.str "Registry IO error: %s" (Printexc.to_string e)) 112 + err_io e 107 113 | Failure msg -> 108 114 Logs.err (fun m -> m "Registry parse error: %s" msg); 109 - Error (Fmt.str "Invalid registry: %s" msg) 115 + err_invalid msg 110 116 | exn -> 111 117 Logs.err (fun m -> 112 118 m "Unexpected registry error: %s" (Printexc.to_string exn)); 113 - Error (Fmt.str "Registry error: %s" (Printexc.to_string exn)) 119 + err exn 114 120 115 121 let save ~fs path registry = 116 122 let path_str = Fpath.to_string path in