]>
Commit | Line | Data |
---|---|---|
f5918330 | 1 | /* |
5e0de328 | 2 | * Copyright (C) 2009-2012 the libgit2 contributors |
f5918330 | 3 | * |
bb742ede VM |
4 | * This file is part of libgit2, distributed under the GNU GPL v2 with |
5 | * a Linking Exception. For full terms see the included COPYING file. | |
f5918330 | 6 | */ |
ae234862 AE |
7 | #ifndef INCLUDE_git_errors_h__ |
8 | #define INCLUDE_git_errors_h__ | |
b3039bee | 9 | |
f31bd03f VM |
10 | #include "common.h" |
11 | ||
ae234862 | 12 | /** |
f5918330 | 13 | * @file git2/errors.h |
ae234862 AE |
14 | * @brief Git error handling routines and variables |
15 | * @ingroup Git | |
16 | * @{ | |
17 | */ | |
ae234862 AE |
18 | GIT_BEGIN_DECL |
19 | ||
e172cf08 VM |
20 | /** Generic return codes */ |
21 | enum { | |
22 | GIT_OK = 0, | |
23 | GIT_ERROR = -1, | |
904b67e6 VM |
24 | GIT_ENOTFOUND = -3, |
25 | GIT_EEXISTS = -4, | |
26 | GIT_EAMBIGUOUS = -5, | |
27 | GIT_EBUFS = -6, | |
5dca2010 | 28 | GIT_EUSER = -7, |
904b67e6 | 29 | |
e172cf08 | 30 | GIT_PASSTHROUGH = -30, |
904b67e6 | 31 | GIT_REVWALKOVER = -31, |
e172cf08 | 32 | }; |
60bc2d20 VM |
33 | |
34 | typedef struct { | |
35 | char *message; | |
36 | int klass; | |
f87d9beb | 37 | } git_error; |
6810bf28 | 38 | |
798e4d53 | 39 | /** Error classes */ |
60bc2d20 VM |
40 | typedef enum { |
41 | GITERR_NOMEMORY, | |
1a481123 | 42 | GITERR_OS, |
7c7ff7d1 | 43 | GITERR_INVALID, |
45d387ac | 44 | GITERR_REFERENCE, |
1a481123 | 45 | GITERR_ZLIB, |
cb8a7961 | 46 | GITERR_REPOSITORY, |
e54d8d89 | 47 | GITERR_CONFIG, |
dda708e7 | 48 | GITERR_REGEX, |
7c7ff7d1 | 49 | GITERR_ODB, |
73fe6a8e | 50 | GITERR_INDEX, |
4376f7f6 CMN |
51 | GITERR_OBJECT, |
52 | GITERR_NET, | |
3aa351ea CMN |
53 | GITERR_TAG, |
54 | GITERR_TREE, | |
73d87a09 | 55 | GITERR_INDEXER, |
dbb36e1b | 56 | GITERR_SSL, |
aa13bf05 | 57 | GITERR_SUBMODULE, |
e172cf08 | 58 | } git_error_t; |
60bc2d20 | 59 | |
e3c47510 RB |
60 | /** |
61 | * Return the last `git_error` object that was generated for the | |
62 | * current thread or NULL if no error has occurred. | |
63 | * | |
64 | * @return A git_error object. | |
65 | */ | |
3fbcac89 | 66 | GIT_EXTERN(const git_error *) giterr_last(void); |
e3c47510 RB |
67 | |
68 | /** | |
69 | * Clear the last library error that occurred for this thread. | |
70 | */ | |
3fbcac89 | 71 | GIT_EXTERN(void) giterr_clear(void); |
e3c47510 | 72 | |
ae234862 AE |
73 | /** @} */ |
74 | GIT_END_DECL | |
75 | #endif |