Replaced "no_such_parameter" exception with "std::out_of_range". Fixed argument of std::out_of_range.

This commit is contained in:
Vincent Richard 2013-11-23 10:16:06 +01:00
parent def7890884
commit f91b1ec6a0
6 changed files with 26 additions and 42 deletions

View File

@ -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;

View File

@ -142,18 +142,6 @@ exception* no_digest_algorithm_available::clone() const { return new no_digest_a
const char* no_digest_algorithm_available::name() const throw() { return "no_digest_algorithm_available"; }
//
// 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
//

View File

@ -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;

View File

@ -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);
}

View File

@ -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:

View File

@ -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);