]> git.ipfire.org Git - thirdparty/git.git/blob - reftable/error.c
build: centos/RHEL 7 ships with an older gcc and zlib
[thirdparty/git.git] / reftable / error.c
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 "reftable-error.h"
10
11 #include <stdio.h>
12
13 const char *reftable_error_str(int err)
14 {
15 static char buf[250];
16 switch (err) {
17 case REFTABLE_IO_ERROR:
18 return "I/O error";
19 case REFTABLE_FORMAT_ERROR:
20 return "corrupt reftable file";
21 case REFTABLE_NOT_EXIST_ERROR:
22 return "file does not exist";
23 case REFTABLE_LOCK_ERROR:
24 return "data is outdated";
25 case REFTABLE_API_ERROR:
26 return "misuse of the reftable API";
27 case REFTABLE_ZLIB_ERROR:
28 return "zlib failure";
29 case REFTABLE_NAME_CONFLICT:
30 return "file/directory conflict";
31 case REFTABLE_EMPTY_TABLE_ERROR:
32 return "wrote empty table";
33 case REFTABLE_REFNAME_ERROR:
34 return "invalid refname";
35 case -1:
36 return "general error";
37 default:
38 snprintf(buf, sizeof(buf), "unknown error code %d", err);
39 return buf;
40 }
41 }