change the naming of invalidOperation exception to the more fc-friendly

invalid_operation, and add an implementation so it can be used.
This commit is contained in:
Eric Frias 2014-05-09 11:50:18 -04:00
parent 615f2463fb
commit 37330ca005
2 changed files with 25 additions and 15 deletions

View file

@ -171,7 +171,7 @@ namespace fc
FC_DECLARE_EXCEPTION( out_of_range_exception, "Out of Range" ); FC_DECLARE_EXCEPTION( out_of_range_exception, "Out of Range" );
/** @brief if an operation is unsupported or not valid this may be thrown */ /** @brief if an operation is unsupported or not valid this may be thrown */
FC_DECLARE_EXCEPTION( invalidOperation_exception, "Invalid Operation" ); FC_DECLARE_EXCEPTION( invalid_operation_exception, "Invalid Operation" );
/** /**
* @brief used to report a canceled Operation * @brief used to report a canceled Operation

View file

@ -24,6 +24,7 @@ namespace fc
eof_exception_code = 11, eof_exception_code = 11,
db_in_use_exception_code = 12, db_in_use_exception_code = 12,
std_exception_code = 14, std_exception_code = 14,
invalid_operation_exception_code = 15
}; };
void to_variant( detail::exception_code e, variant& v ) void to_variant( detail::exception_code e, variant& v )
@ -69,6 +70,9 @@ namespace fc
case db_in_use_exception_code: case db_in_use_exception_code:
v = "db_in_use"; v = "db_in_use";
break; break;
case invalid_operation_exception_code:
v = "invalid_operation";
break;
case unspecified_exception_code: case unspecified_exception_code:
default: default:
v = "unspecified"; v = "unspecified";
@ -93,6 +97,7 @@ namespace fc
else if( v == "std" ) ll = std_exception_code; else if( v == "std" ) ll = std_exception_code;
else if( v == "eof" ) ll = eof_exception_code; else if( v == "eof" ) ll = eof_exception_code;
else if( v == "db_in_use") ll = db_in_use_exception_code; else if( v == "db_in_use") ll = db_in_use_exception_code;
else if( v == "invalid_operation") ll = invalid_operation_exception_code;
else FC_THROW_EXCEPTION( bad_cast_exception, else FC_THROW_EXCEPTION( bad_cast_exception,
"Invalid Error Report _code '${code}'", "Invalid Error Report _code '${code}'",
("code", v) ); ("code", v) );
@ -178,6 +183,7 @@ namespace fc
FC_EXCEPTION_IMPL(key_not_found_exception) FC_EXCEPTION_IMPL(key_not_found_exception)
FC_EXCEPTION_IMPL(bad_cast_exception) FC_EXCEPTION_IMPL(bad_cast_exception)
FC_EXCEPTION_IMPL(out_of_range_exception) FC_EXCEPTION_IMPL(out_of_range_exception)
FC_EXCEPTION_IMPL(invalid_operation_exception);
FC_EXCEPTION_IMPL(canceled_exception) FC_EXCEPTION_IMPL(canceled_exception)
FC_EXCEPTION_IMPL(assert_exception) FC_EXCEPTION_IMPL(assert_exception)
FC_EXCEPTION_IMPL(eof_exception) FC_EXCEPTION_IMPL(eof_exception)
@ -295,6 +301,8 @@ namespace fc
throw eof_exception( my->_elog ); throw eof_exception( my->_elog );
case detail::db_in_use_exception_code: case detail::db_in_use_exception_code:
throw db_in_use_exception( my->_elog ); throw db_in_use_exception( my->_elog );
case detail::invalid_operation_exception_code:
throw invalid_operation_exception( my->_elog );
case detail::std_exception_code: case detail::std_exception_code:
throw std_exception( *this ); throw std_exception( *this );
case detail::unspecified_exception_code: case detail::unspecified_exception_code:
@ -330,6 +338,8 @@ namespace fc
return std::make_shared<eof_exception>( my->_elog ); return std::make_shared<eof_exception>( my->_elog );
case detail::db_in_use_exception_code: case detail::db_in_use_exception_code:
return std::make_shared<db_in_use_exception>( my->_elog ); return std::make_shared<db_in_use_exception>( my->_elog );
case detail::invalid_operation_exception_code:
return std::make_shared<invalid_operation_exception>( my->_elog );
case detail::std_exception_code: case detail::std_exception_code:
return std::make_shared<std_exception>( *this ); return std::make_shared<std_exception>( *this );
case detail::unspecified_exception_code: case detail::unspecified_exception_code: