1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*
* Copyright (C) 2009-2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_errors_h__
#define INCLUDE_git_errors_h__
#include "common.h"
/**
* @file git2/errors.h
* @brief Git error handling routines and variables
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
#ifdef GIT_OLD_ERRORS
enum {
GIT_SUCCESS = 0,
GIT_ERROR = -1,
GIT_ENOTOID = -2,
GIT_ENOTFOUND = -3,
GIT_ENOMEM = -4,
GIT_EOSERR = -5,
GIT_EOBJTYPE = -6,
GIT_ENOTAREPO = -7,
GIT_EINVALIDTYPE = -8,
GIT_EMISSINGOBJDATA = -9,
GIT_EPACKCORRUPTED = -10,
GIT_EFLOCKFAIL = -11,
GIT_EZLIB = -12,
GIT_EBUSY = -13,
GIT_EBAREINDEX = -14,
GIT_EINVALIDREFNAME = -15,
GIT_EREFCORRUPTED = -16,
GIT_ETOONESTEDSYMREF = -17,
GIT_EPACKEDREFSCORRUPTED = -18,
GIT_EINVALIDPATH = -19,
GIT_EREVWALKOVER = -20,
GIT_EINVALIDREFSTATE = -21,
GIT_ENOTIMPLEMENTED = -22,
GIT_EEXISTS = -23,
GIT_EOVERFLOW = -24,
GIT_ENOTNUM = -25,
GIT_ESTREAM = -26,
GIT_EINVALIDARGS = -27,
GIT_EOBJCORRUPTED = -28,
GIT_EAMBIGUOUS = -29,
GIT_EPASSTHROUGH = -30,
GIT_ENOMATCH = -31,
GIT_ESHORTBUFFER = -32,
};
#else
/** Generic return codes */
enum {
GIT_OK = 0,
GIT_ERROR = -1,
GIT_ENOTFOUND = -3,
GIT_EEXISTS = -4,
GIT_EAMBIGUOUS = -5,
GIT_EBUFS = -6,
GIT_PASSTHROUGH = -30,
GIT_REVWALKOVER = -31,
};
#endif
typedef struct {
char *message;
int klass;
} git_error;
typedef enum {
GITERR_NOMEMORY,
GITERR_OS,
GITERR_INVALID,
GITERR_REFERENCE,
GITERR_ZLIB,
GITERR_REPOSITORY,
GITERR_CONFIG,
GITERR_REGEX,
GITERR_ODB,
GITERR_INDEX,
GITERR_OBJECT,
GITERR_NET,
GITERR_TAG,
GITERR_TREE,
GITERR_INDEXER,
GITERR_SSL,
} git_error_t;
/**
* Return the last `git_error` object that was generated for the
* current thread or NULL if no error has occurred.
*
* @return A git_error object.
*/
GIT_EXTERN(const git_error *) giterr_last(void);
/**
* Clear the last library error that occurred for this thread.
*/
GIT_EXTERN(void) giterr_clear(void);
/** @} */
GIT_END_DECL
#endif
|