forked from enviPath/enviPy
## Major Changes - Implement a REST style API app in epapi - Currently implements a GET method for all entity types in the browse menu (both package level and global) - Provides paginated results per default with query style filtering for reviewed vs unreviewed. - Provides new paginated templates with thin wrappers per entity types for easier maintainability - Implements e2e tests for the API ## Minor changes - Added more comprehensive gitignore to cover coverage reports and other test/node.js etc. data. - Add additional CI file for API tests that only gets triggered on API relevant changes. ## ⚠️ Currently only works with session-based authentication. Token based will be added in new PR. Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Co-authored-by: jebus <lorsbach@envipath.com> Reviewed-on: enviPath/enviPy#243 Co-authored-by: Tobias O <tobias.olenyi@envipath.com> Co-committed-by: Tobias O <tobias.olenyi@envipath.com>
29 lines
574 B
Python
29 lines
574 B
Python
from ninja.errors import HttpError
|
|
|
|
|
|
class EPAPIError(HttpError):
|
|
status_code: int = 500
|
|
|
|
def __init__(self, message: str) -> None:
|
|
super().__init__(status_code=self.status_code, message=message)
|
|
|
|
@classmethod
|
|
def from_exception(cls, exc: Exception):
|
|
return cls(message=str(exc))
|
|
|
|
|
|
class EPAPIUnauthorizedError(EPAPIError):
|
|
status_code = 401
|
|
|
|
|
|
class EPAPIPermissionDeniedError(EPAPIError):
|
|
status_code = 403
|
|
|
|
|
|
class EPAPINotFoundError(EPAPIError):
|
|
status_code = 404
|
|
|
|
|
|
class EPAPIValidationError(EPAPIError):
|
|
status_code = 422
|