Skip to content

Error enums need to be human readable #1339

Description

@leafty

The type RepositoryError = GitUrlError | RepositoryMetadataError is a union of enums and these errors are frequently "converted" to error messages by just doing str(repositoryError) which creates a non-readable error message, e.g. metadata_unknown.

These enums should always be converted to a human-readable message when we are returning/raising an error response, e.g.

if repositoryError in [RepositoryMetadataError.metadata_unknown, RepositoryMetadataError.metadata_unauthorized]:
    raise errors.ForbiddenError(message=f"You do not have access to repository {repo}.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions