Feature #1766

More informative exceptions for misconfigurations

Added by R. Yaghoubzadeh over 7 years ago. Updated over 7 years ago.

Status:ResolvedStart date:02/12/2014
Priority:LowDue date:
Assignee:J. Moringen% Done:

100%

Category:C++
Target version:rsb-0.11

Description

When providing a malformed configuration string (as either env var or config file line), such as - in my case - an unescaped Windows path ( RSC_PLUGINS_CPP_PATH=C:\Users\myuser\path\rsbplugins ), RSB applications currently crash with a raw boost exception from the tokenizer, which is not very informative to the end user (at least to me it was not :-) ).

For user-friendliness, maybe those configuration exceptions could be caught and wrapped in a more informative Exception (along the lines of "Tokenizer failure - malformed configuration string: <MYVARNAME>=<myvalue>" or similar)?


Related issues

Related to Robotics Service Bus - Tasks #1768: Evaluate Boost.Exception for dealing with re-thrown excep... New 02/14/2014

History

#1 Updated by J. Wienke over 7 years ago

Could you please provide the exception output and if possible backtrace that you were experiencing?

#2 Updated by R. Yaghoubzadeh over 7 years ago

It is a boost::escaped_list_error, and can easily be provoked by using unescaped backslashes in config strings (as a Windows user might easily do with path names). With "C:\plugins" the exception gets the argument "unknown escape sequence", with "C:\", "cannot end with escape". Of course it is nice to have escapeable strings as properties (and use double backslashes for Windows paths), but it would be nice to get a proper warning that it was a config string that caused a program abort ... I was quite puzzled at first.

One backtrace below (sorry, I just needed some time to recompile rsb here myself to get the debug symbols):

rsc0.10.dll!boost::escaped_list_separator<char,std::char_traits<char> >::do_escape<std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >(std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> > & next, std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> > end, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & tok)  Line 146 + 0x34 bytes

rsc0.10.dll!boost::escaped_list_separator<char,std::char_traits<char> >::operator()<std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >(std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> > & next, std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> > end, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & tok)  Line 176 + 0x24 bytes

rsc0.10.dll!boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::increment()  Line 52 + 0x31 bytes

rsc0.10.dll!boost::iterator_core_access::increment<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & f)  Line 521

rsc0.10.dll!boost::iterator_facade<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,boost::forward_traversal_tag,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,int>::operator++()  Line 660 + 0xe bytes

rsc0.10.dll!std::_Copy_impl<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _First, boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _Last, std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _Dest, std::_Nonscalar_ptr_iterator_tag __formal)  Line 2143 + 0x15 bytes

rsc0.10.dll!std::_Copy_impl<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _First, boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _Last, std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _Dest)  Line 2165 + 0x6a bytes

rsc0.10.dll!std::_Copy_impl<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _First, boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _Last, std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _Dest, std::input_iterator_tag __formal, std::input_iterator_tag __formal)  Line 2186 + 0x4f bytes

rsc0.10.dll!std::_Copy_impl<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _First, boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _Last, std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _Dest, std::tr1::integral_constant<bool,1> __formal)  Line 2206 + 0x7b bytes

rsc0.10.dll!std::copy<boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >(boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _First, boost::token_iterator<boost::escaped_list_separator<char,std::char_traits<char> >,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > _Last, std::back_insert_iterator<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > _Dest)  Line 2227 + 0xa1 bytes

rsc0.10.dll!rsc::plugins::Configurator::splitValue(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & value)  Line 153 + 0x76 bytes

rsc0.10.dll!rsc::plugins::Configurator::handleOption(const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > & key, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & value)  Line 111 + 0x13 bytes

rsc0.10.dll!rsc::config::ConfigFileSource::provideOptions(rsc::config::OptionHandler & handler)  Line 88 + 0x24 bytes

rsc0.10.dll!rsc::config::configure(rsc::config::OptionHandler & handler, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & configFileName, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & environmentVariablePrefix, int argc, const char * * argv, bool stripEnvironmentVariablePrefix, const boost::filesystem::path & prefix)  Line 108

rsb.dll!rsb::Factory::Factory()  Line 210 + 0x77 bytes

rsb.dll!rsc::patterns::Singleton<rsb::Factory>::getInstance()  Line 106 + 0x22 bytes

rsb.dll!rsb::Factory::getInstanceBase()  Line 169

rsb.dll!rsb::getFactory()  Line 165          

#3 Updated by J. Moringen over 7 years ago

  • Status changed from New to In Progress
  • Assignee set to J. Moringen
  • Target version set to rsb-0.11

#4 Updated by J. Moringen over 7 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Fixed by rsc:1ed34190.

New exception message should look like this:

$ RSB_PLUGINS_CPP_PATH='c:\foo' rsb-infocpp0.11
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Invalid plugin load path (option plugins.cpp.path) value `c:\foo': unknown escape sequence
Aborted

Also available in: Atom PDF