/src/git/reftable/error.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | Copyright 2020 Google LLC |
3 | | |
4 | | Use of this source code is governed by a BSD-style |
5 | | license that can be found in the LICENSE file or at |
6 | | https://developers.google.com/open-source/licenses/bsd |
7 | | */ |
8 | | |
9 | | #include "system.h" |
10 | | #include "reftable-error.h" |
11 | | |
12 | | #include <stdio.h> |
13 | | |
14 | | const char *reftable_error_str(int err) |
15 | 0 | { |
16 | 0 | static char buf[250]; |
17 | 0 | switch (err) { |
18 | 0 | case REFTABLE_IO_ERROR: |
19 | 0 | return "I/O error"; |
20 | 0 | case REFTABLE_FORMAT_ERROR: |
21 | 0 | return "corrupt reftable file"; |
22 | 0 | case REFTABLE_NOT_EXIST_ERROR: |
23 | 0 | return "file does not exist"; |
24 | 0 | case REFTABLE_LOCK_ERROR: |
25 | 0 | return "data is locked"; |
26 | 0 | case REFTABLE_API_ERROR: |
27 | 0 | return "misuse of the reftable API"; |
28 | 0 | case REFTABLE_ZLIB_ERROR: |
29 | 0 | return "zlib failure"; |
30 | 0 | case REFTABLE_EMPTY_TABLE_ERROR: |
31 | 0 | return "wrote empty table"; |
32 | 0 | case REFTABLE_REFNAME_ERROR: |
33 | 0 | return "invalid refname"; |
34 | 0 | case REFTABLE_ENTRY_TOO_BIG_ERROR: |
35 | 0 | return "entry too large"; |
36 | 0 | case REFTABLE_OUTDATED_ERROR: |
37 | 0 | return "data concurrently modified"; |
38 | 0 | case -1: |
39 | 0 | return "general error"; |
40 | 0 | default: |
41 | 0 | snprintf(buf, sizeof(buf), "unknown error code %d", err); |
42 | 0 | return buf; |
43 | 0 | } |
44 | 0 | } |