-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1749 from dandi/exception-name
- Loading branch information
Showing
16 changed files
with
85 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
from rest_framework import status | ||
|
||
from dandiapi.api.services.exceptions import DandiException | ||
from dandiapi.api.services.exceptions import DandiError | ||
|
||
|
||
class DandisetOwnerRequired(DandiException): | ||
class DandisetOwnerRequiredError(DandiError): | ||
http_status_code = status.HTTP_403_FORBIDDEN | ||
|
||
|
||
class DraftDandisetNotModifiable(DandiException): | ||
class DraftDandisetNotModifiableError(DandiError): | ||
http_status_code = status.HTTP_405_METHOD_NOT_ALLOWED | ||
message = 'Only draft versions can be modified.' | ||
|
||
|
||
class AssetAlreadyExists(DandiException): | ||
class AssetAlreadyExistsError(DandiError): | ||
http_status_code = status.HTTP_409_CONFLICT | ||
message = 'An asset with that path already exists' | ||
|
||
|
||
class AssetPathConflict(DandiException): | ||
class AssetPathConflictError(DandiError): | ||
http_status_code = status.HTTP_409_CONFLICT | ||
|
||
def __init__(self, new_path: str, existing_paths: list[str]) -> None: | ||
message = f'Path of new asset "{new_path}" conflicts with existing assets: {existing_paths}' | ||
super().__init__(message) | ||
|
||
|
||
class ZarrArchiveBelongsToDifferentDandiset(DandiException): | ||
class ZarrArchiveBelongsToDifferentDandisetError(DandiError): | ||
http_status_code = status.HTTP_400_BAD_REQUEST | ||
message = 'The zarr archive belongs to a different dandiset' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from rest_framework import status | ||
|
||
from dandiapi.api.services.exceptions import DandiException | ||
from dandiapi.api.services.exceptions import DandiError | ||
|
||
|
||
class DandisetAlreadyExists(DandiException): | ||
class DandisetAlreadyExistsError(DandiError): | ||
http_status_code = status.HTTP_400_BAD_REQUEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from rest_framework import status | ||
|
||
from dandiapi.api.services.exceptions import DandiException | ||
from dandiapi.api.services.exceptions import DandiError | ||
|
||
|
||
class AssetNotEmbargoed(DandiException): | ||
class AssetNotEmbargoedError(DandiError): | ||
http_status_code = status.HTTP_400_BAD_REQUEST | ||
message = 'Only embargoed assets can be unembargoed.' | ||
|
||
|
||
class DandisetNotEmbargoed(DandiException): | ||
class DandisetNotEmbargoedError(DandiError): | ||
http_status_code = status.HTTP_400_BAD_REQUEST | ||
message = 'Dandiset not embargoed' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from rest_framework import status | ||
|
||
from dandiapi.api.services.exceptions import DandiException | ||
from dandiapi.api.services.exceptions import DandiError | ||
|
||
|
||
class AssetHasBeenPublished(DandiException): | ||
class AssetHasBeenPublishedError(DandiError): | ||
http_status_code = status.HTTP_500_INTERNAL_SERVER_ERROR | ||
message = 'This asset has been published and cannot be modified.' | ||
|
||
|
||
class VersionHasBeenPublished(DandiException): | ||
class VersionHasBeenPublishedError(DandiError): | ||
http_status_code = status.HTTP_500_INTERNAL_SERVER_ERROR | ||
message = 'This version has been published and cannot be modified.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.