Skip to content

Common Exception Hierarchy #23

@vaclavHala

Description

@vaclavHala

All of these can be found in cz.muni.fi.pv243.spatialtracker.common together with a corresponding ExceptionMapper.

  • SpatialTrackerException
    • checked, abstract, all other exceptions extend this
  • IllegalOperationException
    • Maps to HTTP 403
    • Thrown when the target of a operation exists and caller is authorized to perform operation of this type, however the context, parameterization etc. of the particular invocation are invalid.
  • InvalidInputException
    • Maps to HTTP 400
    • Thrown when input received from user is incomplete, contains invalid values etc. This exception contains collection of all errors found in the users input .
    • Contains collection of all errors that were found in the input (email taken, too short password, ...)
  • NotFoundException
    • Maps to HTTP 404
    • Thrown when the resource user wishes to access does not exist.
    • Contains identifier of the object/resource that was not found
  • UnauthorizedException
    • Maps to HTTP 401
    • Thrown when a user tries to perform an action without being authorized to.
  • BackendServiceException
    • Maps to HTTP 500
    • Thrown when one of depended-on services is unavailable, returns unexpected values or reports its own internal error.

All of the exceptions are checked so they have to at least be declared and rethrown everywhere to make it obvious what are all the things that can go wrong. Please either use one of the above or add new subclass to the list and use that. Do not throw unchecked exceptions from top level public service methods.

Any of these can be thrown from outward facing REST endpoint and will be mapped correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions