Skip to content

Commit 48d9033

Browse files
committed
Add more error message reporting to index generation
1 parent ecf6c68 commit 48d9033

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/newmap-generate-index.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ static PyObject* py_generate_fm_index(PyObject* self, PyObject* args) {
3535
return NULL;
3636
}
3737

38+
if(returnCode == AwFmAllocationFailure){
39+
PyErr_SetString(PyExc_MemoryError,
40+
"Could not allocate enough memory to create index\n");
41+
return NULL;
42+
}
43+
44+
if(returnCode == AwFmFileAlreadyExists){
45+
PyErr_SetString(PyExc_FileExistsError,
46+
"Index file already exists at given location\n");
47+
return NULL;
48+
}
49+
50+
if(returnCode == AwFmFileWriteFail){
51+
PyErr_SetString(PyExc_OSError,
52+
"Could not write index file\n");
53+
return NULL;
54+
}
55+
3856
/* Return None in Python */
3957
Py_RETURN_NONE;
4058
}

0 commit comments

Comments
 (0)