MCPcopy Create free account
hub / github.com/libgit2/pygit2 / Error_type

Function Error_type

src/error.c:34–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32extern PyObject *InvalidSpecError;
33
34PyObject *
35Error_type(int type)
36{
37 const git_error* error;
38 /* Expected */
39 switch (type) {
40 /* Input does not exist in the scope searched. */
41 case GIT_ENOTFOUND:
42 return PyExc_KeyError;
43
44 /* A reference with this name already exists */
45 case GIT_EEXISTS:
46 return AlreadyExistsError;
47
48 /* The given short oid is ambiguous */
49 case GIT_EAMBIGUOUS:
50 return PyExc_ValueError;
51
52 /* The buffer is too short to satisfy the request */
53 case GIT_EBUFS:
54 return PyExc_ValueError;
55
56 /* Invalid input spec */
57 case GIT_EINVALIDSPEC:
58 return InvalidSpecError;
59
60 /* Skip and passthrough the given ODB backend */
61 case GIT_PASSTHROUGH:
62 return GitError;
63
64 /* No entries left in ref walker */
65 case GIT_ITEROVER:
66 return PyExc_StopIteration;
67 }
68
69 /* Critical */
70 error = git_error_last();
71 if (error != NULL) {
72 switch (error->klass) {
73 case GITERR_NOMEMORY:
74 return PyExc_MemoryError;
75 case GITERR_OS:
76 return PyExc_OSError;
77 case GITERR_INVALID:
78 return PyExc_ValueError;
79 }
80 }
81 return GitError;
82}
83
84
85PyObject *

Callers 3

py_hex_to_git_oidFunction · 0.85
Error_setFunction · 0.85
Error_set_strFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…