Support multi-error wrapping in go #316

Closed
opened 2023-05-04 10:43:41 +00:00 by fyrchik · 4 comments
Owner

After go1.20 we can wrap multiple errors https://go.dev/doc/go1.20#errors
I don't like the idea but let's discuss whether we need it.

As an example where this could be useful:

  1. If we couldn't put objects to any shard, we can save an error for each.
  2. If we couldn't connect to any morph endpoint, again, we can save all errors.
After go1.20 we can wrap multiple errors https://go.dev/doc/go1.20#errors I don't like the idea but let's discuss whether we need it. As an example where this could be useful: 1. If we couldn't put objects to any shard, we can save an error for each. 2. If we couldn't connect to any morph endpoint, again, we can save all errors.
fyrchik added the
discussion
triage
go
labels 2023-05-04 10:43:41 +00:00
fyrchik added this to the vNext milestone 2023-05-18 08:31:10 +00:00
Author
Owner

TBH I would add some linter which prohibits its usage completely.

TBH I would add some linter which prohibits its usage completely.
Member

TBH I would add some linter which prohibits its usage completely.

but why?

> TBH I would add some linter which prohibits its usage completely. but why?
Author
Owner

I think it is easy to add lot's of unnecessary context this way without thinking at all, which makes is harder to handle errors.
And all the cases I was thinking about (e.g. put object fails on each shard, combine errors) (1) require more context than simple "wrap" can provide and (2) have a dynamic number of errors to combine.

Do you have any particular usecase we can apply for node right now?

I think it is easy to add lot's of unnecessary context this way without thinking at all, which makes is harder to handle errors. And all the cases I was thinking about (e.g. put object fails on each shard, combine errors) (1) require more context than simple "wrap" can provide and (2) have a dynamic number of errors to combine. Do you have any particular usecase we can apply for node right now?
Member

I don't have a particular use case from the top of my head. I was just wondering what was the argument to have a linter prohibit it; that seems to go a bit overboard.

While I'm not buying the multiwrap thing yet, I'm willing to entertain ideas employing it. Error handling in node is quite messy, and also there's the fact that if some of our dependencies start to employ it as part of their public API, the interaction might be weird if we have a linter getting in the middle.

I don't have a particular use case from the top of my head. I was just wondering what was the argument to have a linter prohibit it; that seems to go a bit overboard. While I'm not buying the multiwrap thing yet, I'm willing to entertain ideas employing it. Error handling in node is quite messy, and also there's the fact that if some of our dependencies start to employ it as part of their public API, the interaction might be weird if we have a linter getting in the middle.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#316
No description provided.