4084: Merge branch 'master' into 4084-log-pane-refresh-TC
[arvados.git] / sdk / python / arvados / errors.py
1 # errors.py - Arvados-specific exceptions.
2
3 import json
4 from apiclient import errors as apiclient_errors
5
6 class ApiError(apiclient_errors.HttpError):
7     def _get_reason(self):
8         try:
9             return '; '.join(json.loads(self.content)['errors'])
10         except (KeyError, TypeError, ValueError):
11             return super(ApiError, self)._get_reason()
12
13
14 class ArgumentError(Exception):
15     pass
16 class SyntaxError(Exception):
17     pass
18 class AssertionError(Exception):
19     pass
20 class CommandFailedError(Exception):
21     pass
22 class KeepReadError(Exception):
23     pass
24 class KeepWriteError(Exception):
25     pass
26 class NotFoundError(KeepReadError):
27     pass
28 class NotImplementedError(Exception):
29     pass
30 class NoKeepServersError(Exception):
31     pass
32 class StaleWriterStateError(Exception):
33     pass