[BuildStream] Error consistency



For a number of patches that I have worked on I have had to tweak our errors to make various errors more consistent.

Why are our Errors so inconsistent?

We have most of our errors in:

src/buildstream/_exceptions.py

But we have a few others scattered around the code base.

Even in our _exceptions file we have quite a lot of inconsistency.

Almost all of the Errors in the _exeptions.py file have constructors along the lines of:

```
    def __init__(self, message, *, detail=None, reason=None):
```

But we also have:

```
    def __init__(self, reason, message, *, ...
```

Many use the `*` notation to require named arguments but several do not. Many accept detail and reason but many do not. This all adds time and effort required for dev's to work out what is require from the errors that they could instead be using to solve real issues.

Would buildstream accept a patch making the Errors more consistent, consolidating them all in _exeptions.py and fixing any fall out?

Would the community be welcoming of something like **kwargs used in the various error constructors in place of the named arguments after the `*` to make boiler plate more consistent?

And do we really want `LoadError` to have such different syntax to every other error?

Thanks
Will

PS.

For ArtifactError

```
    class ArtifactError(BstError):
def __init__(self, message, *, detail=None, reason=None, temporary=False): super().__init__(message, detail=detail, domain=ErrorDomain.ARTIFACT, reason=reason, temporary=True)
```

Why do we have temporary as a constructor argument and then ignore it when we call the base class constructor? I presume this is a bug that should be fixed but is there some hidden magic i am missing?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]