cljacoby / pyproj

A CLI for python projects
MIT License
0 stars 0 forks source link

Determine canonical/suitable pattern for error handling #2

Closed cljacoby closed 4 years ago

cljacoby commented 4 years ago

I'm not really interested in introducing an error-handling crate like failure or error-chian because I want to understand how the error handling system actually works first. Additionally, I'm not sure how much advantage there is to be gained in using one of these in a relatively simple CLI application.

That being said, I'm also not really sure what the conventional error handling pattern looks like. It seems like using an enum of error variants seems like a good approach. Should these enum variants accept a payload of some information on the error, and if so should this payload be its own struct?

Basically determine a slim but viable error handling pattern for the project, without adding any additional purpose-specific crates.

cljacoby commented 4 years ago

This guy rules: https://blog.burntsushi.net/rust-error-handling/

Follow this guide for error handling pattern.