diff options
| author | David Bremner <david@tethera.net> | 2016-11-27 23:01:42 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2016-12-07 07:00:40 -0400 |
| commit | d74c5345704136611f993ca38e0d035b1da798b6 (patch) | |
| tree | a9d5383e410994bb0261d704fe1a102f9639e1d7 /status.c | |
| parent | 9259b97fa2659ae6b6dbcd49b04db087e64036ad (diff) | |
cli/insert: return EX_TEMPFAIL for some errors
Attempt to distinguish between errors indicating misconfiguration or
programmer error, which we consider "permanent", in the sense that
automatic retries are unlikely to be useful, and those indicating
transient error conditions. We consider XAPIAN_EXCEPTION transient
because it covers the important special case of locking failure.
Diffstat (limited to 'status.c')
| -rw-r--r-- | status.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -36,3 +36,19 @@ print_status_database (const char *loc, } return status; } + +int +status_to_exit (notmuch_status_t status) +{ + switch (status) { + case NOTMUCH_STATUS_SUCCESS: + return EXIT_SUCCESS; + case NOTMUCH_STATUS_OUT_OF_MEMORY: + case NOTMUCH_STATUS_XAPIAN_EXCEPTION: + case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: + case NOTMUCH_STATUS_FILE_ERROR: + return EX_TEMPFAIL; + default: + return EXIT_FAILURE; + } +} |
