return (NULL);
}
- if (self->cppobj->getHeaderFlag(
+ try {
+ if (self->cppobj->getHeaderFlag(
static_cast<Message::HeaderFlag>(messageflag))) {
- Py_RETURN_TRUE;
- } else {
- Py_RETURN_FALSE;
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+ } catch (const isc::InvalidParameter& ip) {
+ PyErr_Clear();
+ PyErr_SetString(po_InvalidParameter, ip.what());
+ return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in getHeaderFlag");
+ return (NULL);
}
}
PyErr_Clear();
PyErr_SetString(po_InvalidParameter, ip.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in setHeaderFlag");
+ return (NULL);
}
}
} catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in setQid");
+ return (NULL);
}
}
} catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in setRcode");
+ return (NULL);
}
}
} catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in setOpcode");
+ return (NULL);
}
}
} catch (const InvalidMessageOperation& imo) {
PyErr_SetString(po_InvalidMessageOperation, imo.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in setEDNS");
+ return (NULL);
}
}
} catch (const isc::OutOfRange& ex) {
PyErr_SetString(PyExc_OverflowError, ex.what());
return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in getRRCount");
+ return (NULL);
}
}
return (NULL);
}
- self->cppobj->addQuestion(PyQuestion_ToQuestion(question));
-
- Py_RETURN_NONE;
+ try {
+ self->cppobj->addQuestion(PyQuestion_ToQuestion(question));
+ Py_RETURN_NONE;
+ } catch (const InvalidMessageOperation& imo) {
+ PyErr_Clear();
+ PyErr_SetString(po_InvalidMessageOperation, imo.what());
+ return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception in addQuestion");
+ return (NULL);
+ }
}
PyObject*
PyObject*
Message_clear(s_Message* self, PyObject* args) {
int i;
- if (PyArg_ParseTuple(args, "i", &i)) {
- PyErr_Clear();
- if (i == Message::PARSE) {
- self->cppobj->clear(Message::PARSE);
- Py_RETURN_NONE;
- } else if (i == Message::RENDER) {
- self->cppobj->clear(Message::RENDER);
- Py_RETURN_NONE;
- } else {
- PyErr_SetString(PyExc_TypeError,
- "Message mode must be Message.PARSE or Message.RENDER");
- return (NULL);
+
+ try {
+ if (PyArg_ParseTuple(args, "i", &i)) {
+ PyErr_Clear();
+ if (i == Message::PARSE) {
+ self->cppobj->clear(Message::PARSE);
+ Py_RETURN_NONE;
+ } else if (i == Message::RENDER) {
+ self->cppobj->clear(Message::RENDER);
+ Py_RETURN_NONE;
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "Message mode must be Message.PARSE or Message.RENDER");
+ return (NULL);
+ }
}
- } else {
- return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException,
+ "Unexpected exception when clearing message");
}
+ return (NULL);
}
PyObject*
return (NULL);
} catch (...) {
PyErr_SetString(po_IscException,
- "Unexpected exception in adding RRset");
+ "Unexpected exception in clearSection");
return (NULL);
}
}
PyObject*
Message_makeResponse(s_Message* self) {
- self->cppobj->makeResponse();
- Py_RETURN_NONE;
+ try {
+ self->cppobj->makeResponse();
+ Py_RETURN_NONE;
+ } catch (const InvalidMessageOperation& imo) {
+ PyErr_Clear();
+ PyErr_SetString(po_InvalidMessageOperation, imo.what());
+ return (NULL);
+ } catch (...) {
+ PyErr_SetString(po_IscException, "Unexpected exception in Message.makeResponse");
+ return (NULL);
+ }
}
PyObject*