mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-09 22:00:18 -04:00
* Implemented API routes for getting all, creating, updating, and deleting resources, services, and tags. * Updated main.py for API routes to include tags and rolled entities back. * Created API routes for create, update, delete, get_all, and get_by_name. Deleted service methods for get by id. * Defaults created_at to current time * Write markdown file for HTTP requests using curl --------- Co-authored-by: pmoharana-cmd <pmoharana032474@gmail.com>
28 lines
969 B
Python
28 lines
969 B
Python
"""
|
|
This file contains exceptions found in the service layer.
|
|
|
|
These custom exceptions can then be handled peoperly
|
|
at the API level.
|
|
"""
|
|
|
|
|
|
class ResourceNotFoundException(Exception):
|
|
"""ResourceNotFoundException is raised when a user attempts to access a resource that does not exist."""
|
|
|
|
|
|
class UserPermissionException(Exception):
|
|
"""UserPermissionException is raised when a user attempts to perform an action they are not authorized to perform."""
|
|
|
|
def __init__(self, action: str, resource: str):
|
|
super().__init__(f"Not authorized to perform `{action}` on `{resource}`")
|
|
|
|
|
|
class ServiceNotFoundException(Exception):
|
|
"""Exception for when the service being requested is not in the table."""
|
|
|
|
class TagNotFoundException(Exception):
|
|
"""Exception for when the tag being requested is not in the table."""
|
|
|
|
class ProgramNotAssignedException(Exception):
|
|
"""Exception for when the user does not have correct access for requested services."""
|