Skip to content

Commit e58da96

Browse files
Merge pull request #9948 from PhrozenByte/docs-return-codes-1.4
Refactor return code docs [1.4-maint]
2 parents 2bf0ff1 + 19f3001 commit e58da96

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

‎docs/usage/general/return-codes.rst.inc‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,37 @@ Borg can exit with the following return codes (rc):
77
Return code Meaning
88
=========== =======
99
0 success (logged as INFO)
10-
1 generic warning (operation reached its normal end, but there were warnings --
11-
you should check the log, logged as WARNING)
12-
2 generic error (like a fatal error, a local or remote exception, the operation
13-
did not reach its normal end, logged as ERROR)
14-
3..99 specific error (enabled by BORG_EXIT_CODES=modern)
15-
100..127 specific warning (enabled by BORG_EXIT_CODES=modern)
16-
128+N killed by signal N (e.g. 137 == kill -9)
10+
1 generic warning (operation reached its normal end, but there
11+
were warnings - you should check the log; logged as WARNING)
12+
2 generic error (such as a fatal error or a local/remote exception;
13+
the operation did not reach its normal end; logged as ERROR)
14+
3..99 specific error (enabled by ``BORG_EXIT_CODES=modern``,
15+
see below; logged as ERROR)
16+
100..127 specific warning (enabled by ``BORG_EXIT_CODES=modern``,
17+
see below; logged as WARNING)
18+
128+N terminated by signal N (e.g. 130 == SIGINT, Ctrl+C, or kill -2;
19+
logged as ERROR)
1720
=========== =======
1821

1922
If you use ``--show-rc``, the return code is also logged at the indicated
2023
level as the last log entry.
2124

22-
The modern exit codes (return codes, "rc") are documented there: :ref:`msgid`
25+
Borg categorizes return codes into groups and exits with the more severe
26+
group: signals (rc 128+N) are more severe than errors (rc 2 and 3..99),
27+
which take precedence over warnings (rc 1 and 100..127), and lastly
28+
success (rc 0).
29+
30+
Borg 1 exits with the generic error (rc 2) and warning (rc 1) codes
31+
by default. If you want Borg 1 to exit with specific error (rc 3..99)
32+
and warning (rc 100..127) codes instead (like Borg 2 does), set the
33+
``BORG_EXIT_CODES=modern`` environment variable.
34+
35+
If modern exit codes are enabled (``BORG_EXIT_CODES=modern``):
36+
Within the signal and error groups, the first signal or error determines
37+
the final return code. Within the warning group, Borg returns the specific
38+
warning code (rc 100..127) if there were one or more warnings of the same
39+
kind. If warnings of different kinds occurred, Borg returns the generic
40+
warning code (rc 1) instead. All errors and warnings are still logged
41+
individually.
42+
43+
For a list of all specific error and warning codes, see :ref:`msgid`.

0 commit comments

Comments
 (0)