Files
mdrs-client-python/mdrsclient/exceptions.py
T
orrisroot 3081d7fbb3 fix: report a locked folder as FolderLockedException
Fetching a locked folder before its password is sent returns 200 with
only its listing fields, without metadata, sub_folders and path, so
FoldersApi.retrieve failed with a pydantic ValidationError. The DOI
route fetches the folder before it can see the lock, so a
password-protected DOI folder could not be opened even with its
password.

- Add FolderLockedException, a subclass of UnauthorizedException, and
  raise it from retrieve on that short record and from the lock checks.
- On a DOI folder, send the password and fetch it again when the first
  fetch finds it locked.
2026-11-13 19:01:56 +09:00

59 lines
1.3 KiB
Python

class MDRSException(Exception):
"""Thrown when some kind of errors occurred"""
pass
class IllegalArgumentException(MDRSException):
"""Thrown when something wrong with the argument is passed to a method"""
pass
class MissingConfigurationException(MDRSException):
"""Thrown when wrong or missing system configuration"""
pass
class BadRequestException(MDRSException):
"""Thrown when the request does not contain valid parameter"""
pass
class UnauthorizedException(MDRSException):
"""Thrown when the current user not allowed to perform an operation on the resource"""
pass
class FolderLockedException(UnauthorizedException):
"""Thrown when a folder cannot be opened without its password"""
pass
class TokenExpiredException(UnauthorizedException):
"""Thrown when the access token was still valid when sent but had expired on arrival"""
pass
class ServerBusyException(MDRSException):
"""Thrown when the server did not start handling a request before its token lapsed"""
pass
class ForbiddenException(MDRSException):
"""Thrown when the current user does not have enough privileges to access the resource"""
pass
class UnexpectedException(MDRSException):
"""Thrown when unexpected error occurred"""
pass