Commit 207038a3 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1407] Cleanups

parent 5dc77264
......@@ -100,31 +100,25 @@ Rdata_init(s_Rdata* self, PyObject* args) {
input_buffer, len);
return (0);
}
}
catch (const isc::dns::rdata::InvalidRdataText& irdt) {
} catch (const isc::dns::rdata::InvalidRdataText& irdt) {
PyErr_SetString(po_InvalidRdataText, irdt.what());
return (-1);
}
catch (const isc::dns::rdata::InvalidRdataLength& irdl) {
} catch (const isc::dns::rdata::InvalidRdataLength& irdl) {
PyErr_SetString(po_InvalidRdataLength, irdl.what());
return (-1);
}
catch (const isc::dns::rdata::CharStringTooLong& cstl) {
} catch (const isc::dns::rdata::CharStringTooLong& cstl) {
PyErr_SetString(po_CharStringTooLong, cstl.what());
return (-1);
}
catch (const isc::dns::DNSMessageFORMERR& dmfe) {
} catch (const isc::dns::DNSMessageFORMERR& dmfe) {
PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
return (-1);
}
// FIXME: These exceptions are not tested, I don't know how or if
// at all they can be triggered. But they are caught just in the case.
catch (const std::exception& ex) {
} catch (const std::exception& ex) {
// FIXME: These exceptions are not tested, I don't know how or if
// at all they can be triggered. But they are caught just in the case.
PyErr_SetString(PyExc_Exception, (std::string("Unknown exception: ") +
ex.what()).c_str());
return (-1);
}
catch (...) {
} catch (...) {
PyErr_SetString(PyExc_Exception, "Unknown exception");
return (-1);
}
......
......@@ -37,11 +37,8 @@ class RdataTest(unittest.TestCase):
self.assertRaises(TypeError, Rdata, RRType("A"), RRClass("IN"), 1)
self.assertRaises(InvalidRdataText, Rdata, RRType("A"), RRClass("IN"),
"Invalid Rdata Text")
s = ""
for i in range(0, 256):
s += ' '
self.assertRaises(CharStringTooLong, Rdata, RRType("TXT"),
RRClass("IN"), s)
RRClass("IN"), ' ' * 256)
self.assertRaises(InvalidRdataLength, Rdata, RRType("TXT"),
RRClass("IN"), bytes(65536))
self.assertRaises(DNSMessageFORMERR, Rdata, RRType("TXT"),
......
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