douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.
https://crates.io/crates/pdbtbx
MIT License
54 stars 16 forks source link

Use *thiserror* for error handling #21

Closed TianyiShi2001 closed 3 years ago

TianyiShi2001 commented 3 years ago

I suggest using thiserror for error handling. There's a great article explaining why it's more ergonomic and efficient than manual implementation (which convinced me to use thiserror in my crates): https://nick.groenen.me/posts/rust-error-handling/

rust-bio have also adopted thiserror recently.

douweschulte commented 3 years ago

Cool I will look into it as well then.

douweschulte commented 3 years ago

I looked at it and did not really see obvious improvements over doing it manually, especially because I had a somewhat weird idea in my head of having an Error type which both can be used as a library return error (so easy for other programmers) as for display to end users.