-
Notifications
You must be signed in to change notification settings - Fork 2
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 #399 from geoadmin/develop
New Release v1.21.0 - #minor
- Loading branch information
Showing
9 changed files
with
126 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import logging | ||
|
||
from django.utils.translation import gettext_lazy as _ | ||
|
||
import rest_framework.exceptions | ||
from rest_framework import status | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class StacAPIException(rest_framework.exceptions.APIException): | ||
'''STAC API custom exception | ||
These exception can add additional data to the HTTP response. | ||
''' | ||
|
||
def __init__(self, detail=None, code=None, data=None): | ||
super().__init__(detail, code) | ||
if isinstance(data, dict): | ||
self.data = data | ||
elif data: | ||
self.data = {'data': data} | ||
|
||
|
||
class UploadNotInProgressError(StacAPIException): | ||
status_code = status.HTTP_409_CONFLICT | ||
default_detail = _('No upload in progress') | ||
default_code = 'conflict' | ||
|
||
|
||
class UploadInProgressError(StacAPIException): | ||
status_code = status.HTTP_409_CONFLICT | ||
default_detail = _('Upload already in progress') | ||
default_code = 'conflict' |
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
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
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