Skip to content

Commit

Permalink
Fix logic for error output.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Jun 18, 2020
1 parent f26f007 commit 5164429
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pdal/util/ProgramArgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,14 @@ class TArg : public Arg
std::string error(m_error);

if (error.empty())
error = "Invalid value for argument '" + m_longname + "': " +
status.what();
if (error.empty())
error = "Invalid value '" + s + "' for argument '" +
m_longname + "'.";
{
if (status.what().size())
error = "Invalid value for argument '" + m_longname +
"': " + status.what();
else
error = "Invalid value '" + s + "' for argument '" +
m_longname + "'.";
}
throw arg_val_error(error);
}
m_set = true;
Expand Down Expand Up @@ -765,11 +768,14 @@ class VArg : public BaseVArg
std::string error(m_error);

if (error.empty())
error = "Invalid value for argument '" + m_longname + "': " +
status.what();
if (error.empty())
error = "Invalid value '" + s + "' for argument '" +
m_longname + "'.";
{
if (status.what().size())
error = "Invalid value for argument '" + m_longname +
"': " + status.what();
else
error = "Invalid value '" + s + "' for argument '" +
m_longname + "'.";
}
throw arg_val_error(error);
}
if (!m_set)
Expand Down

0 comments on commit 5164429

Please sign in to comment.