Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a more specific exception #8

Merged
merged 1 commit into from
Aug 12, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions modules/c++/six/source/ParameterCollection.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "six/Parameter.h"
#include "six/ParameterCollection.h"
#include <except/Exception.h>
#include <six/Parameter.h>
#include <six/ParameterCollection.h>

#include <import/except.h>

size_t six::ParameterCollection::findParameterIndex(const std::string& paramName) const
namespace six
{
size_t
ParameterCollection::findParameterIndex(const std::string& paramName) const
{
for(size_t ii = 0; ii < mParams.size(); ++ii)
{
Expand All @@ -13,11 +15,13 @@ size_t six::ParameterCollection::findParameterIndex(const std::string& paramName
}
}

throw except::Exception("No parameter with name \"" + paramName
+ "\" found in this collection");
throw except::NoSuchKeyException(Ctxt(
"No parameter with name \"" + paramName
+ "\" found in this collection"));
}

bool six::ParameterCollection::containsParameter(const std::string& paramName) const
bool
ParameterCollection::containsParameter(const std::string& paramName) const
{
for(size_t ii = 0; ii < mParams.size(); ++ii)
{
Expand All @@ -29,3 +33,4 @@ bool six::ParameterCollection::containsParameter(const std::string& paramName) c

return false;
}
}