Merge branch 'ob/t3501-retitle'
[alt-git.git] / reftable / error.c
blob0d1766735e8ff0f1c5c057d1882728aa4292d1ee
1 /*
2 Copyright 2020 Google LLC
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 */
9 #include "system.h"
10 #include "reftable-error.h"
12 #include <stdio.h>
14 const char *reftable_error_str(int err)
16 static char buf[250];
17 switch (err) {
18 case REFTABLE_IO_ERROR:
19 return "I/O error";
20 case REFTABLE_FORMAT_ERROR:
21 return "corrupt reftable file";
22 case REFTABLE_NOT_EXIST_ERROR:
23 return "file does not exist";
24 case REFTABLE_LOCK_ERROR:
25 return "data is outdated";
26 case REFTABLE_API_ERROR:
27 return "misuse of the reftable API";
28 case REFTABLE_ZLIB_ERROR:
29 return "zlib failure";
30 case REFTABLE_NAME_CONFLICT:
31 return "file/directory conflict";
32 case REFTABLE_EMPTY_TABLE_ERROR:
33 return "wrote empty table";
34 case REFTABLE_REFNAME_ERROR:
35 return "invalid refname";
36 case REFTABLE_ENTRY_TOO_BIG_ERROR:
37 return "entry too large";
38 case -1:
39 return "general error";
40 default:
41 snprintf(buf, sizeof(buf), "unknown error code %d", err);
42 return buf;