[Rock-dev] improving error messages in ruby

Alexander Duda Alexander.Duda at dfki.de
Wed Mar 21 18:06:25 CET 2012


On Wed, 2012-03-21 at 17:50 +0100, Sylvain Joyeux wrote:
> On 03/21/2012 03:42 PM, Alexander Duda wrote:
> > There are cases there certain ruby libs are not available but are
> > required by a ruby script. To improve the error messages in these cases
> > I was thinking of introducing a rock_require.
> >
> > Example:
> > rock_require 'TypelibQtAdapter' , "#{ERROR_VIZKIT_IS_NOT_FULLY_BUILD}"
> >
> > rock_require would evaluating the second string if the require of the
> > first string fails and prints the resulting string as error message.
> >
> > The variable ERROR_VIZKIT_IS_NOT_FULLY_BUILD is a constant which gives a
> > description of the error + how to solve the error.
> >
> > Any comments?
> Not sure. I'm usually funny with having this kind of "special" methods 
> that redefine the normal workflow.
I agree, therefore the impact on the work-flow should be as small as
possible. 

> 
> Obviously, there are a few issues: where do you define rock_require and 
> the error constants ? How do you make sure that they are loaded already 
> ? What's the exact use case you have in mind ?
It often happens that someone is using vizkit.rb without having vizkt
built. The reason is that they think that invoking "autoproj build ." is
building everything which is needed to run their component. But this is
obviously not true if they are using vizkit insight their scripts.

The rock_require is an attempt to give a better feedback if something
cannot not be found. (adding "expert" knowledge)

I don't really see a nice way to detect thinks like this without having
side effects. 

Declaring packages which are always being built even if someone calls
"build ." might be a better solution.

Alex


-- 
Dipl.-Ing. Alexander Duda 
Unterwasserrobotik

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Phone: +49 (0)421 178-456620
Fax:   +49 (0)421 178-454150
E-Mail: alexander.duda at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3



More information about the Rock-dev mailing list