OWissett / freesasa-rs

A rust crate to interface with the freesasa library for protein surface area calculations
https://crates.io/crates/freesasa-rs
Other
6 stars 1 forks source link

Improve Error handling #3

Open OWissett opened 1 year ago

OWissett commented 1 year ago

Right now, the library typically returns a static string for the error type because it is easy.

The issue is that this is not very descriptive.

We should implement our own Error types or change over to anyhow errors, which can provide improved usage.

OWissett commented 1 year ago

Often freesasa C-api will return different error return codes, these should be reflected in the errors (which can't be done with static string errors)

OWissett commented 1 year ago

E.g.

        if res_code == freesasa_error_codes_FREESASA_SUCCESS {
            Ok(())
        } else {
            Err("Failed to add atom to structure") // Here we should return a more useful error message 
        }
OWissett commented 1 year ago

I have started on this on the branch ow/errors

I have implemented a custom Error type which can provide better context and error handling