Commit dafdb6c8 authored by Michael Tremer's avatar Michael Tremer

writer: Throw better exception when network address was invalid

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 364a2a37
......@@ -127,8 +127,12 @@ static PyObject* Writer_add_network(WriterObject* self, PyObject* args) {
// Create network object
int r = loc_writer_add_network(self->writer, &network, string);
if (r)
if (r) {
if (r == -EINVAL)
PyErr_SetString(PyExc_ValueError, "Invalid network");
return NULL;
}
PyObject* obj = new_network(&NetworkType, network);
loc_network_unref(network);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment