From 96077ce7e6125cdba959925d0a2b7b1f8ee54046 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 22 Nov 2013 13:32:52 +0100 Subject: Do not throw exception for normal code flow (exceptions::no_such_field). --- src/mdn/receivedMDNInfos.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/mdn/receivedMDNInfos.cpp') diff --git a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp index 1c523be7..53b2281e 100644 --- a/src/mdn/receivedMDNInfos.cpp +++ b/src/mdn/receivedMDNInfos.cpp @@ -110,18 +110,23 @@ void receivedMDNInfos::extract() header fields; fields.parse(oss.str()); - try { m_omid = *fields.OriginalMessageId()->getValue (); } - catch (exceptions::no_such_field&) { /* Ignore */ } - - try { m_disp = *fields.Disposition()->getValue (); } - catch (exceptions::no_such_field&) { /* Ignore */ } - - try - { - text t = *fields.findField("Received-content-MIC")->getValue (); - m_contentMIC = t.generate(); - } - catch (exceptions::no_such_field&) { /* Ignore */ } + shared_ptr omid = + fields.findFieldValue (fields::ORIGINAL_MESSAGE_ID); + + if (omid) + m_omid = *omid; + + shared_ptr disp = + fields.findFieldValue (fields::DISPOSITION); + + if (disp) + m_disp = *disp; + + shared_ptr contentMIC = + fields.findFieldValue ("Received-content-MIC"); + + if (contentMIC) + m_contentMIC = contentMIC->generate(); } } } -- cgit