Skip to content
Snippets Groups Projects
Commit ed5d7880 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Make exception messages more explicit.

     * src/signal/signal-caster.cpp.
parent d769287d
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,10 @@ void SignalCaster::disp(const any& object, ostream& os) {
functions_.find(type_name);
if ( it == functions_.end() )
throw ExceptionSignal(ExceptionSignal::BAD_CAST, "bad cast");
throw ExceptionSignal(ExceptionSignal::BAD_CAST,
"unable to display type "+
std::string(type_name)+
" into ostream.");
//TODO: throw "cast not registered" exception
(*it).second.get<0>()(object, os); // call display function (tuple index 0)
}
......@@ -87,7 +90,10 @@ void SignalCaster::trace(const any& object, ostream& os) {
map<string, cast_functions_type>::iterator it =
functions_.find(type_name);
if ( it == functions_.end() )
throw ExceptionSignal(ExceptionSignal::BAD_CAST, "bad cast");;
throw ExceptionSignal(ExceptionSignal::BAD_CAST,
"unable to trace type "+
std::string(type_name)+
" into ostream.");
//TODO: throw "cast not registered" exception
(*it).second.get<2>()(object, os); // call trace function (tuple index 2)
}
......@@ -98,10 +104,9 @@ any SignalCaster::cast(const type_info& type, istringstream& iss) {
if ( it == functions_.end() )
{
std::string msg("type " + std::string(type_name) +
" not in functions_ map.");
throw ExceptionSignal(ExceptionSignal::BAD_CAST,
msg);
"unable to cast string into type "+
std::string(type_name)+".");
}
//TODO: throw "cast not registered" exception
return (*it).second.get<1>()(iss); // call cast function (tuple index 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment