Skip to content

Commit

Permalink
Merge Bill Nottingham's exception type fix into unstable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Apr 9, 2018
2 parents 192a3c3 + 434dd95 commit c05aeb8
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-address-sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ GncSqlColumnTableEntryImpl<CT_ADDRESS>::load (const GncSqlBackend* sql_be,
set_parameter (addr, val.c_str(), sub_setter,
subtable_row->m_gobj_param_name);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-owner-sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ GncSqlColumnTableEntryImpl<CT_OWNERREF>::load (const GncSqlBackend* sql_be,
if (string_to_guid (val.c_str(), &guid))
pGuid = &guid;
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-slots-sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ gnc_sql_slots_delete (GncSqlBackend* sql_be, const GncGUID* guid)
if (string_to_guid (val.c_str(), &child_guid))
gnc_sql_slots_delete (sql_be, &child_guid);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
continue;
}
Expand Down
24 changes: 12 additions & 12 deletions libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ GncSqlColumnTableEntryImpl<CT_STRING>::load (const GncSqlBackend* sql_be,
auto s = row.get_string_at_col (m_col_name);
set_parameter(pObject, s.c_str(), get_setter(obj_name), m_gobj_param_name);
}
catch (std::invalid_argument) {}
catch (std::invalid_argument&) {}
}

template<> void
Expand Down Expand Up @@ -279,19 +279,19 @@ GncSqlColumnTableEntryImpl<CT_DOUBLE>::load (const GncSqlBackend* sql_be,
{
val = static_cast<double>(row.get_int_at_col(m_col_name));
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
try
{
val = static_cast<double>(row.get_float_at_col(m_col_name));
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
try
{
val = row.get_double_at_col(m_col_name);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
val = 0.0;
}
Expand Down Expand Up @@ -336,7 +336,7 @@ GncSqlColumnTableEntryImpl<CT_GUID>::load (const GncSqlBackend* sql_be,
{
str = row.get_string_at_col(m_col_name);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down Expand Up @@ -391,15 +391,15 @@ GncSqlColumnTableEntryImpl<CT_TIMESPEC>::load (const GncSqlBackend* sql_be,
auto val = row.get_time64_at_col(m_col_name);
timespecFromTime64 (&ts, val);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
try
{
auto val = row.get_string_at_col(m_col_name);
GncDateTime time(val);
ts.tv_sec = static_cast<time64>(time);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down Expand Up @@ -471,15 +471,15 @@ GncSqlColumnTableEntryImpl<CT_TIME64>::load (const GncSqlBackend* sql_be,
{
t = row.get_time64_at_col (m_col_name);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
try
{
auto val = row.get_string_at_col(m_col_name);
GncDateTime time(val);
t = static_cast<time64>(time);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down Expand Up @@ -543,7 +543,7 @@ GncSqlColumnTableEntryImpl<CT_GDATE>::load (const GncSqlBackend* sql_be,
tm->tm_year + 1900);
free(tm);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
try
{
Expand All @@ -557,7 +557,7 @@ GncSqlColumnTableEntryImpl<CT_GDATE>::load (const GncSqlBackend* sql_be,
g_date_set_dmy(&date, day, month, year);

}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down Expand Up @@ -622,7 +622,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
n = gnc_numeric_create (num, denom);
g_free (buf);
}
catch (std::invalid_argument)
catch (std::invalid_argument&)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class GncSqlColumnTableEntry
m_gobj_param_name);
}
}
catch (std::invalid_argument) {}
catch (std::invalid_argument&) {}
}


Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/sql/gnc-transaction-sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ GncSqlColumnTableEntryImpl<CT_TXREF>::load (const GncSqlBackend* sql_be,
if (tx != nullptr)
set_parameter (pObject, tx, get_setter(obj_name), m_gobj_param_name);
}
catch (std::invalid_argument) {}
catch (std::invalid_argument&) {}
}

template<> void
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/engine/Account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5442,7 +5442,7 @@ gnc_account_imap_find_account_bayes (GncImportMatchMap *imap, GList *tokens)
gnc::GUID guid;
try {
guid = gnc::GUID::from_string(best.account_guid);
} catch (gnc::guid_syntax_exception) {
} catch (gnc::guid_syntax_exception&) {
return nullptr;
}
auto account = xaccAccountLookup (reinterpret_cast<GncGUID*>(&guid), imap->book);
Expand Down
8 changes: 4 additions & 4 deletions libgnucash/engine/gnc-date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ gnc_localtime_r (const time64 *secs, struct tm* time)
*time = static_cast<struct tm>(GncDateTime(*secs));
return time;
}
catch(std::invalid_argument)
catch(std::invalid_argument&)
{
return NULL;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ gnc_gmtime (const time64 *secs)
*time = gncdt.utc_tm();
return time;
}
catch(std::invalid_argument)
catch(std::invalid_argument&)
{
return NULL;
}
Expand All @@ -211,7 +211,7 @@ gnc_mktime (struct tm* time)
*time = static_cast<struct tm>(gncdt);
return static_cast<time64>(gncdt);
}
catch(std::invalid_argument)
catch(std::invalid_argument&)
{
return 0;
}
Expand All @@ -232,7 +232,7 @@ gnc_timegm (struct tm* time)
#endif
return static_cast<time64>(gncdt) - gncdt.offset();
}
catch(std::invalid_argument)
catch(std::invalid_argument&)
{
return 0;
}
Expand Down
12 changes: 6 additions & 6 deletions libgnucash/engine/gnc-datetime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ LDT_from_unix_local(const time64 time)
auto tz = tzp.get(temp.date().year());
return LDT(temp, tz);
}
catch(boost::gregorian::bad_year)
catch(boost::gregorian::bad_year&)
{
throw(std::invalid_argument("Time value is outside the supported year range."));
}
Expand All @@ -167,15 +167,15 @@ LDT_from_struct_tm(const struct tm tm)
LDT ldt(tdate, tdur, tz, LDTBase::EXCEPTION_ON_ERROR);
return ldt;
}
catch(boost::gregorian::bad_year)
catch(boost::gregorian::bad_year&)
{
throw(std::invalid_argument("Time value is outside the supported year range."));
}
catch(boost::local_time::time_label_invalid)
catch(boost::local_time::time_label_invalid&)
{
throw(std::invalid_argument("Struct tm does not resolve to a valid time."));
}
catch(boost::local_time::ambiguous_result)
catch(boost::local_time::ambiguous_result&)
{
throw(std::invalid_argument("Struct tm can resolve to more than one time."));
}
Expand Down Expand Up @@ -256,7 +256,7 @@ GncDateTimeImpl::GncDateTimeImpl(const GncDateImpl& date, DayPart part) :
m_time -= hours(offset.hours() - 11);
}
}
catch(boost::gregorian::bad_year)
catch(boost::gregorian::bad_year&)
{
throw(std::invalid_argument("Time value is outside the supported year range."));
}
Expand Down Expand Up @@ -310,7 +310,7 @@ GncDateTimeImpl::GncDateTimeImpl(std::string str) :
m_time = LDT(pdt.date(), pdt.time_of_day(), tzptr,
LDTBase::NOT_DATE_TIME_ON_ERROR);
}
catch(boost::gregorian::bad_year)
catch(boost::gregorian::bad_year&)
{
throw(std::invalid_argument("The date string was outside of the supported year range."));
}
Expand Down
2 changes: 1 addition & 1 deletion libgnucash/engine/gnc-rational.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ GncRational::operator gnc_numeric () const noexcept
{
return {static_cast<int64_t>(m_num), static_cast<int64_t>(m_den)};
}
catch (std::overflow_error)
catch (std::overflow_error&)
{
return gnc_numeric_error (GNC_ERROR_OVERFLOW);
}
Expand Down

0 comments on commit c05aeb8

Please sign in to comment.