Closed MarcelH-Tabeo closed 4 months ago
Hello! Thanks for bringing this up.
The goal of this function is to return a clear and helpful error message (if any). I don't believe the current implementation is complicated. It's a bit verbose, but it serves to have a better error message.
I appreciate your suggestion, but it doesn't follow the happy path pattern. Currently, it's obvious why and when we handle the error.
Using the err == nil
expression is rare, and it's possible to be mistaken with the far more common err != nil
one. Thus, it may result in confusion.
I encourage you to open a new merge request if you come up with a better or less verbose solution. My regards.
This is what my linter shows me:
And by looking at it, I would do an early return around line 59
Then this is complexity 10 ! Just my 2 cents ;-)