Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/errors.h')
-rw-r--r--include/git2/errors.h90
1 files changed, 51 insertions, 39 deletions
diff --git a/include/git2/errors.h b/include/git2/errors.h
index fb6670004..917f0699c 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2012 the libgit2 contributors
+ * Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
@@ -17,43 +17,6 @@
*/
GIT_BEGIN_DECL
-#ifdef GIT_OLD_ERRORS
-enum {
- GIT_SUCCESS = 0,
- 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,
-};
-#endif
-
/** Generic return codes */
enum {
GIT_OK = 0,
@@ -62,9 +25,16 @@ enum {
GIT_EEXISTS = -4,
GIT_EAMBIGUOUS = -5,
GIT_EBUFS = -6,
+ GIT_EUSER = -7,
+ GIT_EBAREREPO = -8,
+ GIT_EORPHANEDHEAD = -9,
+ GIT_EUNMERGED = -10,
+ GIT_ENONFASTFORWARD = -11,
+ GIT_EINVALIDSPEC = -12,
+ GIT_EMERGECONFLICT = -13,
GIT_PASSTHROUGH = -30,
- GIT_REVWALKOVER = -31,
+ GIT_ITEROVER = -31,
};
typedef struct {
@@ -72,6 +42,7 @@ typedef struct {
int klass;
} git_error;
+/** Error classes */
typedef enum {
GITERR_NOMEMORY,
GITERR_OS,
@@ -88,6 +59,13 @@ typedef enum {
GITERR_TAG,
GITERR_TREE,
GITERR_INDEXER,
+ GITERR_SSL,
+ GITERR_SUBMODULE,
+ GITERR_THREAD,
+ GITERR_STASH,
+ GITERR_CHECKOUT,
+ GITERR_FETCHHEAD,
+ GITERR_MERGE,
} git_error_t;
/**
@@ -103,6 +81,40 @@ GIT_EXTERN(const git_error *) giterr_last(void);
*/
GIT_EXTERN(void) giterr_clear(void);
+/**
+ * Set the error message string for this thread.
+ *
+ * This function is public so that custom ODB backends and the like can
+ * relay an error message through libgit2. Most regular users of libgit2
+ * will never need to call this function -- actually, calling it in most
+ * circumstances (for example, calling from within a callback function)
+ * will just end up having the value overwritten by libgit2 internals.
+ *
+ * This error message is stored in thread-local storage and only applies
+ * to the particular thread that this libgit2 call is made from.
+ *
+ * NOTE: Passing the `error_class` as GITERR_OS has a special behavior: we
+ * attempt to append the system default error message for the last OS error
+ * that occurred and then clear the last error. The specific implementation
+ * of looking up and clearing this last OS error will vary by platform.
+ *
+ * @param error_class One of the `git_error_t` enum above describing the
+ * general subsystem that is responsible for the error.
+ * @param message The formatted error message to keep
+ */
+GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
+
+/**
+ * Set the error message to a special value for memory allocation failure.
+ *
+ * The normal `giterr_set_str()` function attempts to `strdup()` the string
+ * that is passed in. This is not a good idea when the error in question
+ * is a memory allocation failure. That circumstance has a special setter
+ * function that sets the error string to a known and statically allocated
+ * internal value.
+ */
+GIT_EXTERN(void) giterr_set_oom(void);
+
/** @} */
GIT_END_DECL
#endif