MCPcopy Create free account
hub / github.com/wal-e/wal-e / UserException

Class UserException

wal_e/exception.py:6–45  ·  view source on GitHub ↗

Superclass intended for user-visible errors Instead of stacktraces, these will be prettyprinted. The suggested error message guidelines are the same as for the PostgreSQL project: http://developer.postgresql.org/pgdocs/postgres/error-style-guide.html If it is necessary t

Source from the content-addressed store, hash-verified

4
5
6class UserException(Exception):
7 """
8 Superclass intended for user-visible errors
9
10 Instead of stacktraces, these will be prettyprinted. The
11 suggested error message guidelines are the same as for the
12 PostgreSQL project:
13
14 http://developer.postgresql.org/pgdocs/postgres/error-style-guide.html
15
16 If it is necessary to trap these exceptions, use a subclass.
17
18 >>> raise UserException(msg='foo', detail='bar')
19 Traceback (most recent call last):
20 ...
21 UserException: ERROR: MSG: foo
22 DETAIL: bar
23 STRUCTURED: time=... pid=...
24 >>> raise UserException(msg='foo', detail='bar', hint='hello')
25 Traceback (most recent call last):
26 ...
27 UserException: ERROR: MSG: foo
28 DETAIL: bar
29 HINT: hello
30 STRUCTURED: time=... pid=...
31 """
32
33 def __init__(self, msg=None, detail=None, hint=None):
34 # msg uses a keyword argument with a default to make the
35 # multiprocessing module happy, as it seems to set them after
36 # the fact. Realistically, one should *always* be setting msg
37 # when used in normal code though.
38 self.msg = msg
39 self.detail = detail
40 self.hint = hint
41 self.severity = ERROR
42
43 def __str__(self):
44 return "{0}: {1}".format(getLevelName(self.severity),
45 WalELogger.fmt_logline(self.msg, self.detail, self.hint))
46
47
48class UserCritical(UserException):

Callers 15

external_program_checkFunction · 0.90
s3_explicit_credsFunction · 0.90
gs_credsFunction · 0.90
configure_backup_cxtFunction · 0.90
psql_csv_runFunction · 0.90
handlerMethod · 0.90
database_fetchMethod · 0.90
database_backupMethod · 0.90
wal_archiveMethod · 0.90
_verify_restore_pathsMethod · 0.90
__init__.pyFile · 0.90
sigv4_check_applyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected