Skip to content

[TM-321] Add error types

Konstantin Ivanov requested to merge martoon/tm321-error-types into master

Description

Problem: we should explicitly state how each error should be handled by middleware/client like web application associate different HTTP codes to their errors.

Solution: introduce 3 types of errors - "action exception", "internal error" and "bad argument". Let developers specify them in CustomErrHasDoc typeclass; by default use "action exception".

Note from MR author: since there is a default value for errDocClass, I'm afraid that it becomes too easy to forget to specify class when necessary, and then documentation would state wrong information. I propose to either remove default value, or use some unknown type by default.

Related issue(s)

https://issues.serokell.io/issue/TM-321

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Edited by Konstantin Ivanov

Merge request reports