huak icon indicating copy to clipboard operation
huak copied to clipboard

Logging and error-handling design

Open dpgraham4401 opened this issue 2 years ago • 3 comments

Discussion

It would be good to have a clear mental map/documentation on how Huak handles errors and logging.

Since these are 2 things that are ubiquitous throughtout Huak, I figure it would be good to have a discussion before something like logging is implemented (i don't huak does much in the way of logging right now?). That way we can be internally consistent.

Another example, the error handling has been improving with HuakError, but do we have a consistent approach across the lib for propogating. Like where does the error propogation stop and turn into a nice readable error for the user? in Ops i'm guessing, but it would be good to document that design decision and why.

I can whip up a quick and dirty digram to aid the conversation.

dpgraham4401 avatar Oct 17 '22 15:10 dpgraham4401

I've put this basic google sheet together, mostly for my comprehension but maybe it can be used as a basic starting point for documentation to help new contributors as well.

dpgraham4401 avatar Oct 17 '22 18:10 dpgraham4401

Note to self: https://github.com/cnpryer/huak/blob/557a61a9b3b9ac5f6dcbc67fd00b81cd97c78881/crates/huak_cli/src/main.rs#L24-L25

cnpryer avatar Oct 15 '23 01:10 cnpryer

Another note would be that adding application-like experience of "a problem occurred" to library errors implemented with thiserror is a little messy. Ideally library error messages and data is limited to what's useful for the specific error so that applications can layer in the experience-enhancing text.

cnpryer avatar Oct 29 '23 22:10 cnpryer