Stream: project-error-handling

Topic: Nuanced terminology about roles of crates


view this post on Zulip Jake Goulding (Sep 23 2020 at 11:54):

error defining (?) vs.

I agree with the sentiment. SNAFU is listed as an error handling crate but I feel that handling has always been the wrong word. It’s a crate that allows you to take an error and produce a new error from it or create an error value out of thin air.

view this post on Zulip Nelson J Morais (Sep 23 2020 at 12:08):

I also have the same sentiment regarding the "Reporter" terminology. what is that?! a error formatter for the cli, human readable and pretty printer? it's an output formatter?

for instance if on a service I want to expose an error occurred locally with additional metadata to an external service in a json format, can I call that a reporter?

view this post on Zulip Jane Lusby (Sep 23 2020 at 12:58):

no

view this post on Zulip Jane Lusby (Sep 23 2020 at 12:59):

I'd define error reporting as creating human readable representation of errors and their context

view this post on Zulip Jane Lusby (Sep 23 2020 at 12:59):

so all of those things you mentioned would fall under that unbrella except the bit about json because that is still a machine first representation

view this post on Zulip Jane Lusby (Sep 23 2020 at 13:00):

that id call serialization

view this post on Zulip pachi (Sep 23 2020 at 13:03):

It's more an error formatter then. Reporting suggests some mechanism for I/O IMHO.

view this post on Zulip pachi (Sep 23 2020 at 13:04):

But, well, this is maybe too bikesheddy

view this post on Zulip Jake Goulding (Sep 23 2020 at 13:10):

One term I toyed with but rejected was "error creation/creating", but that just sounds so bad: "This crate adds errors to your code" :crying_cat:

view this post on Zulip teor (Sep 23 2020 at 13:30):

"Error creating crate" might also be hard to read or spell

view this post on Zulip teor (Sep 23 2020 at 13:31):

create crate

view this post on Zulip pachi (Sep 23 2020 at 14:06):

Well, @Jake Goulding, "error defining" doesn't sound too alien.

view this post on Zulip Jake Goulding (Sep 23 2020 at 14:09):

Agree.

view this post on Zulip Jake Goulding (Sep 23 2020 at 14:09):

And I'm fine with it if there's a consensus

view this post on Zulip pachi (Sep 23 2020 at 14:17):

Just in case it suggests some "functions"/ naming, What I found most confusing about error handling was:

1) how to craft/define a set of custom errors (generic ala dyn Error, enum style, Failure, ...)
2) how to add context to them (depending on the chosen strategy, like wrapping, source, ...)
3) how to invoke/raise those errors (wrap in Err, using ? with implicit conversion, map_err, etc)
4) how to intercept to show them to the user (conversions using From, match, ?, ...).

I still have doubts and have to try and see with parts like the context one.

view this post on Zulip Nelson J Morais (Sep 23 2020 at 14:17):

by "error defining crate" I should interpret that this crate allows me to structurally define a data type that my app will have nd understand as an error, is that it?

view this post on Zulip Nelson J Morais (Sep 23 2020 at 14:18):

:eyes:

view this post on Zulip pachi (Sep 23 2020 at 14:19):

I would understand so.

view this post on Zulip Jane Lusby (Sep 23 2020 at 14:20):

yes @Nelson J Morais

view this post on Zulip Nelson J Morais (Sep 23 2020 at 14:51):

OK great. :grinning_face_with_smiling_eyes:


Last updated: Jan 26 2022 at 14:02 UTC