diff options
Diffstat (limited to 'src/errors.c')
-rw-r--r-- | src/errors.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/errors.c b/src/errors.c new file mode 100644 index 000000000..b3e014dd4 --- /dev/null +++ b/src/errors.c @@ -0,0 +1,23 @@ +#include "common.h" +#include "thread-utils.h" /* for GIT_TLS */ + +/* compile-time constant initialization required */ +GIT_TLS int git_errno = 0; + +static struct { + int num; + const char *str; +} error_codes[] = { + { GIT_ENOTOID, "Not a git oid" }, + { GIT_ENOTFOUND, "Object does not exist in the scope searched" }, +}; + +const char *git_strerror(int num) +{ + int i; + for (i = 0; i < ARRAY_SIZE(error_codes); i++) + if (num == error_codes[i].num) + return error_codes[i].str; + + return "Unknown error"; +} |