syncstorage-rs icon indicating copy to clipboard operation
syncstorage-rs copied to clipboard

Use builder pattern for `TokenserverError`s

Open ethowitz opened this issue 4 years ago • 0 comments

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 ErrorLocation private to the tokenserver::error module
  • Make the fields of TokenserverError private
  • Add a TokenserverErrorBuilder type that allows callers to construct TokenserverErrors

ethowitz avatar Feb 11 '22 21:02 ethowitz