builtin/submodule--helper.c: handle missing submodule URLs
[alt-git.git] / reftable / error.c
blob93941f214570ace6e82e3c0a8b3c83d8b945405f
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 "reftable-error.h"
11 #include <stdio.h>
13 const char *reftable_error_str(int err)
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 REFTABLE_ENTRY_TOO_BIG_ERROR:
36 return "entry too large";
37 case -1:
38 return "general error";
39 default:
40 snprintf(buf, sizeof(buf), "unknown error code %d", err);
41 return buf;