From: Michael Tremer Date: Tue, 30 Jan 2018 15:24:45 +0000 (+0000) Subject: writer: Throw better exception when network address was invalid X-Git-Tag: 0.9.0~91 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=dafdb6c89b8680a4d34ee34e40f18abaf0b36e12 writer: Throw better exception when network address was invalid Signed-off-by: Michael Tremer --- diff --git a/src/python/writer.c b/src/python/writer.c index e21e95b..e0c37b6 100644 --- a/src/python/writer.c +++ b/src/python/writer.c @@ -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);