aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/addressList.cpp12
-rw-r--r--src/exception.cpp12
-rw-r--r--src/mailboxGroup.cpp12
-rw-r--r--src/parameterizedHeaderField.cpp12
-rw-r--r--vmime/exception.hpp12
-rw-r--r--vmime/parameterizedHeaderField.hpp8
6 files changed, 26 insertions, 42 deletions
diff --git a/src/addressList.cpp b/src/addressList.cpp
index 756156d1..15b9227b 100644
--- a/src/addressList.cpp
+++ b/src/addressList.cpp
@@ -151,7 +151,7 @@ void addressList::insertAddressBefore(shared_ptr <address> beforeAddress, shared
(m_list.begin(), m_list.end(), beforeAddress);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(it, addr);
}
@@ -160,7 +160,7 @@ void addressList::insertAddressBefore(shared_ptr <address> beforeAddress, shared
void addressList::insertAddressBefore(const size_t pos, shared_ptr <address> addr)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(m_list.begin() + pos, addr);
}
@@ -172,7 +172,7 @@ void addressList::insertAddressAfter(shared_ptr <address> afterAddress, shared_p
(m_list.begin(), m_list.end(), afterAddress);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(it + 1, addr);
}
@@ -181,7 +181,7 @@ void addressList::insertAddressAfter(shared_ptr <address> afterAddress, shared_p
void addressList::insertAddressAfter(const size_t pos, shared_ptr <address> addr)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(m_list.begin() + pos + 1, addr);
}
@@ -193,7 +193,7 @@ void addressList::removeAddress(shared_ptr <address> addr)
(m_list.begin(), m_list.end(), addr);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.erase(it);
}
@@ -202,7 +202,7 @@ void addressList::removeAddress(shared_ptr <address> addr)
void addressList::removeAddress(const size_t pos)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
const std::vector <shared_ptr <address> >::iterator it = m_list.begin() + pos;
diff --git a/src/exception.cpp b/src/exception.cpp
index 45f672a3..042ac4f4 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -143,18 +143,6 @@ const char* no_digest_algorithm_available::name() const throw() { return "no_dig
//
-// no_such_parameter
-//
-
-no_such_parameter::~no_such_parameter() throw() {}
-no_such_parameter::no_such_parameter(const string& name, const exception& other)
- : exception(string("Parameter not found: '") + name + string("'."), other) {}
-
-exception* no_such_parameter::clone() const { return new no_such_parameter(*this); }
-const char* no_such_parameter::name() const throw() { return "no_such_parameter"; }
-
-
-//
// no_such_field
//
diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
index d4bbb7db..0245affb 100644
--- a/src/mailboxGroup.cpp
+++ b/src/mailboxGroup.cpp
@@ -258,7 +258,7 @@ void mailboxGroup::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, share
(m_list.begin(), m_list.end(), beforeMailbox);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(it, mbox);
}
@@ -267,7 +267,7 @@ void mailboxGroup::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, share
void mailboxGroup::insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(m_list.begin() + pos, mbox);
}
@@ -279,7 +279,7 @@ void mailboxGroup::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_
(m_list.begin(), m_list.end(), afterMailbox);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(it + 1, mbox);
}
@@ -288,7 +288,7 @@ void mailboxGroup::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_
void mailboxGroup::insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.insert(m_list.begin() + pos + 1, mbox);
}
@@ -300,7 +300,7 @@ void mailboxGroup::removeMailbox(shared_ptr <mailbox> mbox)
(m_list.begin(), m_list.end(), mbox);
if (it == m_list.end())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
m_list.erase(it);
}
@@ -309,7 +309,7 @@ void mailboxGroup::removeMailbox(shared_ptr <mailbox> mbox)
void mailboxGroup::removeMailbox(const size_t pos)
{
if (pos >= m_list.size())
- throw std::out_of_range();
+ throw std::out_of_range("Invalid position");
const std::vector <shared_ptr <mailbox> >::iterator it = m_list.begin() + pos;
diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
index 19a0502a..95421b3f 100644
--- a/src/parameterizedHeaderField.cpp
+++ b/src/parameterizedHeaderField.cpp
@@ -454,7 +454,7 @@ void parameterizedHeaderField::insertParameterBefore(shared_ptr <parameter> befo
(m_params.begin(), m_params.end(), beforeParam);
if (it == m_params.end())
- throw exceptions::no_such_parameter(beforeParam->getName());
+ throw std::out_of_range("Invalid position");
m_params.insert(it, param);
}
@@ -462,6 +462,9 @@ void parameterizedHeaderField::insertParameterBefore(shared_ptr <parameter> befo
void parameterizedHeaderField::insertParameterBefore(const size_t pos, shared_ptr <parameter> param)
{
+ if (pos >= m_params.size())
+ throw std::out_of_range("Invalid position");
+
m_params.insert(m_params.begin() + pos, param);
}
@@ -472,7 +475,7 @@ void parameterizedHeaderField::insertParameterAfter(shared_ptr <parameter> after
(m_params.begin(), m_params.end(), afterParam);
if (it == m_params.end())
- throw exceptions::no_such_parameter(afterParam->getName());
+ throw std::out_of_range("Invalid position");
m_params.insert(it + 1, param);
}
@@ -480,6 +483,9 @@ void parameterizedHeaderField::insertParameterAfter(shared_ptr <parameter> after
void parameterizedHeaderField::insertParameterAfter(const size_t pos, shared_ptr <parameter> param)
{
+ if (pos >= m_params.size())
+ throw std::out_of_range("Invalid position");
+
m_params.insert(m_params.begin() + pos + 1, param);
}
@@ -490,7 +496,7 @@ void parameterizedHeaderField::removeParameter(shared_ptr <parameter> param)
(m_params.begin(), m_params.end(), param);
if (it == m_params.end())
- throw exceptions::no_such_parameter(param->getName());
+ throw std::out_of_range("Invalid position");
m_params.erase(it);
}
diff --git a/vmime/exception.hpp b/vmime/exception.hpp
index bb59fe8f..e2afcc62 100644
--- a/vmime/exception.hpp
+++ b/vmime/exception.hpp
@@ -152,18 +152,6 @@ public:
};
-class VMIME_EXPORT no_such_parameter : public vmime::exception
-{
-public:
-
- no_such_parameter(const string& name, const exception& other = NO_EXCEPTION);
- ~no_such_parameter() throw();
-
- exception* clone() const;
- const char* name() const throw();
-};
-
-
class VMIME_EXPORT no_such_field : public vmime::exception
{
public:
diff --git a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp
index 78fc3e44..7a8e8b7d 100644
--- a/vmime/parameterizedHeaderField.hpp
+++ b/vmime/parameterizedHeaderField.hpp
@@ -92,7 +92,7 @@ public:
*
* @param beforeParam parameter before which the new parameter will be inserted
* @param param parameter to insert
- * @throw exceptions::no_such_parameter if the parameter is not in the list
+ * @throw std::out_of_range if the parameter is not in the list
*/
void insertParameterBefore(shared_ptr <parameter> beforeParam, shared_ptr <parameter> param);
@@ -101,6 +101,7 @@ public:
* @param pos position at which to insert the new parameter (0 to insert at
* the beginning of the list)
* @param param parameter to insert
+ * @throw std::out_of_range if the position is out of range
*/
void insertParameterBefore(const size_t pos, shared_ptr <parameter> param);
@@ -108,7 +109,7 @@ public:
*
* @param afterParam parameter after which the new parameter will be inserted
* @param param parameter to insert
- * @throw exceptions::no_such_parameter if the parameter is not in the list
+ * @throw std::out_of_range if the parameter is not in the list
*/
void insertParameterAfter(shared_ptr <parameter> afterParam, shared_ptr <parameter> param);
@@ -116,13 +117,14 @@ public:
*
* @param pos position of the parameter before the new parameter
* @param param parameter to insert
+ * @throw std::out_of_range if the position is out of range
*/
void insertParameterAfter(const size_t pos, shared_ptr <parameter> param);
/** Remove the specified parameter from the list.
*
* @param param parameter to remove
- * @throw exceptions::no_such_parameter if the parameter is not in the list
+ * @throw std::out_of_range if the parameter is not in the list
*/
void removeParameter(shared_ptr <parameter> param);