irmin icon indicating copy to clipboard operation
irmin copied to clipboard

irmin-pack: review resource/error management

Open samoht opened this issue 2 years ago • 0 comments

Would be great to review resource management in case of errors (for instance, some file descriptors might not be properly closed in a few places).

More generally, in some place it's also a bit difficult to track what needs to be done with errors: some of them are just fatal (ie. the user cannot do anything with them anyway). As for the rest of the codebase, abstraction can help here: in case the exception is not useful, we could either just abstract it and expose a pp_error function - as logging it might be the only thing an user could do - or just raise an exception if really there's nothing useful to do anymore. An example of this is https://github.com/mirage/irmin/pull/1950/files/96acbcb0e13ba62e088b804bc36d230e886c4324#r913050362

samoht avatar Jul 05 '22 16:07 samoht