summaryrefslogtreecommitdiff
path: root/src/errors.c
blob: b3e014dd4810983396c9ab09edc7be1e0ed1ff51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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";
}