Skip to content

[FEATURE] - API Specific Error Codes #28

@zdomke

Description

@zdomke

What's the problem this feature will solve?

The APIException class takes in both a status_code value and a code value (changed to error_code in #27 )

The error code is intended to be populated with API Specific error codes so it is clear to users what went wrong in the backend. As of right now this value is populated with the same value as the status code throughout the app. This does nothing to clarify the backend error.

Describe the solution you'd like

We should add an IntEnum containing API specific error codes that can be used throughout the backend.

For example:

from enum import IntEnum


class AppErrorCode(IntEnum):
    DUPLICATE_KEY_NAME = 1001
    KEY_ALREADY_INACTIVE = 1002
    DUPLICATE_PV_NAME = 1003

Additional context

This could be useful for the front end too. The error code would allow for more specific communication between the 2 pieces.
Also can allow users to find out what went wrong with their requests easier.

All around very beneficial. Few downsides.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions