i18n: factorize "no directory given for --foo"
[git/debian.git] / reftable / error.c
blobf6f16def92145494fca3023692338f8f2c8b36c2
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 -1:
36 return "general error";
37 default:
38 snprintf(buf, sizeof(buf), "unknown error code %d", err);
39 return buf;