diff options
Diffstat (limited to 'include/git2/errors.h')
| -rw-r--r-- | include/git2/errors.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/include/git2/errors.h b/include/git2/errors.h index f617986e1..17a701079 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -103,7 +103,7 @@ typedef enum { GIT_EOBJCORRUPTED = -28, /** The given short oid is ambiguous */ - GIT_EAMBIGUOUSOIDPREFIX = -29, + GIT_EAMBIGUOUS = -29, /** Skip and passthrough the given ODB backend */ GIT_EPASSTHROUGH = -30, @@ -113,11 +113,34 @@ typedef enum { /** The buffer is too short to satisfy the request */ GIT_ESHORTBUFFER = -32, +} git_error_t; + +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, +} git_error_class; + /** * Return a detailed error string with the latest error * that occurred in the library. + * @deprecated This will be replaced in the new error handling * @return a string explaining the error */ GIT_EXTERN(const char *) git_lasterror(void); @@ -129,6 +152,7 @@ GIT_EXTERN(const char *) git_lasterror(void); * NOTE: This method will be eventually deprecated in favor * of the new `git_lasterror`. * + * @deprecated This will be replaced in the new error handling * @param num The error code to explain * @return a string explaining the error code */ @@ -136,9 +160,23 @@ GIT_EXTERN(const char *) git_strerror(int num); /** * Clear the latest library error + * @deprecated This will be replaced in the new error handling */ GIT_EXTERN(void) git_clearerror(void); +/** + * 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 *) git_error_last(void); + +/** + * Clear the last library error that occurred for this thread. + */ +GIT_EXTERN(void) git_error_clear(void); + /** @} */ GIT_END_DECL #endif |
