Blame


1 7b19e0f1 2017-11-05 stsp /*
2 0a0a3048 2018-01-10 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 7b19e0f1 2017-11-05 stsp *
4 7b19e0f1 2017-11-05 stsp * Permission to use, copy, modify, and distribute this software for any
5 7b19e0f1 2017-11-05 stsp * purpose with or without fee is hereby granted, provided that the above
6 7b19e0f1 2017-11-05 stsp * copyright notice and this permission notice appear in all copies.
7 7b19e0f1 2017-11-05 stsp *
8 7b19e0f1 2017-11-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 7b19e0f1 2017-11-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 7b19e0f1 2017-11-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 7b19e0f1 2017-11-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 7b19e0f1 2017-11-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 7b19e0f1 2017-11-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 7b19e0f1 2017-11-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 7b19e0f1 2017-11-05 stsp */
16 4027f31a 2017-11-04 stsp
17 4027f31a 2017-11-04 stsp /* Error codes */
18 f334529e 2018-01-12 stsp #define GOT_ERR_ERRNO 0
19 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_MEM 1
20 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_GIT_REPO 2
21 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_ABSPATH 3
22 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PATH 4
23 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_REF 5
24 a1fd68d8 2018-01-12 stsp #define GOT_ERR_IO 6
25 a1fd68d8 2018-01-12 stsp #define GOT_ERR_EOF 7
26 a1fd68d8 2018-01-12 stsp #define GOT_ERR_DECOMPRESSION 8
27 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_SPACE 9
28 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_HDR 10
29 a1fd68d8 2018-01-12 stsp #define GOT_ERR_OBJ_TYPE 11
30 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_DATA 12
31 a1fd68d8 2018-01-12 stsp #define GOT_ERR_FILE_OPEN 13
32 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKIDX 14
33 a1fd68d8 2018-01-12 stsp #define GOT_ERR_PACKIDX_CSUM 15
34 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKFILE 16
35 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_OBJ 17
36 a487c1d0 2018-01-14 stsp #define GOT_ERR_NOT_IMPL 18
37 3ee5fc21 2018-01-17 stsp #define GOT_ERR_OBJ_NOT_PACKED 19
38 96f5e8b3 2018-01-23 stsp #define GOT_ERR_BAD_DELTA_CHAIN 20
39 4027f31a 2017-11-04 stsp
40 4027f31a 2017-11-04 stsp static const struct got_error {
41 4027f31a 2017-11-04 stsp int code;
42 4027f31a 2017-11-04 stsp const char *msg;
43 4027f31a 2017-11-04 stsp } got_errors[] = {
44 f334529e 2018-01-12 stsp { GOT_ERR_ERRNO, "see errno" },
45 4027f31a 2017-11-04 stsp { GOT_ERR_NO_MEM, "out of memory" },
46 4027f31a 2017-11-04 stsp { GOT_ERR_NOT_GIT_REPO, "no git repository found" },
47 4027f31a 2017-11-04 stsp { GOT_ERR_NOT_ABSPATH, "absolute path expected" },
48 4027f31a 2017-11-04 stsp { GOT_ERR_BAD_PATH, "bad path" },
49 4027f31a 2017-11-04 stsp { GOT_ERR_NOT_REF, "no such reference found" },
50 ab9a70b2 2017-11-06 stsp { GOT_ERR_IO, "input/output error" },
51 ab9a70b2 2017-11-06 stsp { GOT_ERR_EOF, "unexpected end of file" },
52 ab9a70b2 2017-11-06 stsp { GOT_ERR_DECOMPRESSION,"decompression failed" },
53 ab9a70b2 2017-11-06 stsp { GOT_ERR_NO_SPACE, "buffer too small" },
54 ab9a70b2 2017-11-06 stsp { GOT_ERR_BAD_OBJ_HDR, "bad object header" },
55 d1cda826 2017-11-06 stsp { GOT_ERR_OBJ_TYPE, "wrong type of object" },
56 d1cda826 2017-11-06 stsp { GOT_ERR_BAD_OBJ_DATA, "bad object data" },
57 7d283eee 2017-11-29 stsp { GOT_ERR_FILE_OPEN, "could not open file" },
58 0a0a3048 2018-01-10 stsp { GOT_ERR_BAD_PACKIDX, "bad pack index file" },
59 0ebaf008 2018-01-10 stsp { GOT_ERR_PACKIDX_CSUM, "pack index file checksum error" },
60 a1fd68d8 2018-01-12 stsp { GOT_ERR_BAD_PACKFILE, "bad pack file" },
61 a1fd68d8 2018-01-12 stsp { GOT_ERR_NO_OBJ, "object not found" },
62 a487c1d0 2018-01-14 stsp { GOT_ERR_NOT_IMPL, "feature not implemented" },
63 3ee5fc21 2018-01-17 stsp { GOT_ERR_OBJ_NOT_PACKED,"object is not packed" },
64 96f5e8b3 2018-01-23 stsp { GOT_ERR_BAD_DELTA_CHAIN,"bad delta chain" },
65 4027f31a 2017-11-04 stsp };
66 4027f31a 2017-11-04 stsp
67 4027f31a 2017-11-04 stsp const struct got_error * got_error(int code);
68 f334529e 2018-01-12 stsp const struct got_error *got_error_from_errno();
69 8251fdbc 2018-01-12 stsp const struct got_error *got_ferror(FILE *, int);