[Rock-dev] improving error messages in ruby

Sylvain Joyeux sylvain.joyeux at dfki.de
Wed Mar 21 17:50:27 CET 2012


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.

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 ?
-- 
Sylvain Joyeux (Dr.Ing.)
Space & Security Robotics

!!! Achtung, neue Telefonnummer!!!

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

Phone: +49 (0)421 178-454136
Fax:   +49 (0)421 218-454150
E-Mail: robotik 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