syncstorage-rs
syncstorage-rs copied to clipboard
Use builder pattern for `TokenserverError`s
Constructing a TokenserverError is arduous in situations where an error needs to be tailored to a very specific situation. In particular, where callers can't make use of the utility methods defined on TokenserverError, constructing an error requires knowledge of the ErrorLocation type and requires access to the internal fields of the struct. This could be simplified by using the builder pattern, which will make it much easier for callers to tailor errors to their liking in an ergonomic way. It will also make it much easier to create errors that are very similar to the errors returned by the utility methods with small alterations.
Acceptance Criteria
- Make
ErrorLocationprivate to thetokenserver::errormodule - Make the fields of
TokenserverErrorprivate - Add a
TokenserverErrorBuildertype that allows callers to constructTokenserverErrors