Skip to content

Commit

Permalink
Errors: Add CommunityNotSelectedError for conditional check on config
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed Sep 16, 2024
1 parent 1e58730 commit 26f8b7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions invenio_records_resources/resources/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
QuerystringValidationError,
RecordPermissionDeniedError,
RevisionIdMismatchError,
CommunityNotSelectedError,
)


Expand Down Expand Up @@ -207,4 +208,10 @@ class ErrorHandlersMixin:
description="Uploading selected files will result in exceeding the max amount per record.",
)
),
CommunityNotSelectedError: create_error_handler(
HTTPJSONException(
code=400,
description="Cannot publish without selecting a community.",
)
),
}
4 changes: 4 additions & 0 deletions invenio_records_resources/services/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,7 @@ def __init__(self, max_files, resulting_files_count):
)
)
)


class CommunityNotSelectedError(Exception):
"""Error thrown when a record is being created/updated with less than 1 community."""

0 comments on commit 26f8b7c

Please sign in to comment.