[Dancer-users] sane error messages

Flavio Poletti polettix at gmail.com
Sun Jun 24 18:21:56 CEST 2012


On Sun, Jun 24, 2012 at 3:10 PM, sawyer x <xsawyerx at gmail.com> wrote:
> On Sun, Jun 24, 2012 at 3:59 PM, Mr. Puneet Kishor <punk.kish at gmail.com>
> wrote:
>> Could the error messages be made more sane by default?
>
> There are several ways and they were often discussed.

I don't remember following such discussions so forgive me if I restate
some already discussed suggestions.


> Instead, another way is to provide a cleaner more understandable output when
> YAML fails. Unfortunately we can't always control how it failed. We do try
> to make it clear it's the parser by writing "Unable to parse the
> configuration file". We're more than open on any suggestion you may have on
> how to make this easier.

I think this is sane, and the output message actually said that there
was a problem in parsing the configuration file:

----
Error while loading
/Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl:
Unable to parse the configuration file:
/Volumes/roller/Users/punkish/Sites_development/earthbase/environments/development.yml:
Died at /opt/local/lib/perl5/site_perl/5.14.1/YAML/Loader.pm line 676,
<$IN> line 1.
at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 202
  Dancer::Config::load_settings_from_yaml('/Volumes/roller/Users/punkish/Sites_development/earthbase/env...')
called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line
182
  Dancer::Config::load('Dancer::Config') called at
/opt/local/lib/perl5/site_perl/5.14.1/Dancer.pm line 258
...
----

The fact is that - probably - it was followed by a lot of other
things. Were it written like this, maybe it would be less frustrating:

----
Unable to parse the configuration file (check syntax for errors)

Configuration file is at
/Volumes/roller/Users/punkish/Sites_development/earthbase/environments/development.yml
Application is at
/Volumes/roller/Users/punkish/Sites_development/earthbase/bin/app.pl
Died at /opt/local/lib/perl5/site_perl/5.14.1/YAML/Loader.pm line 676,
<$IN> line 1.
at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line 202
  Dancer::Config::load_settings_from_yaml('/Volumes/roller/Users/punkish/Sites_development/earthbase/env...')
called at /opt/local/lib/perl5/site_perl/5.14.1/Dancer/Config.pm line
182
  Dancer::Config::load('Dancer::Config') called at
/opt/local/lib/perl5/site_perl/5.14.1/Dancer.pm line 258
...
-----

i.e. just make the message stand out with respect to the additional debug info.

It would also help to have some hints about how to check for errors in
the configuration file, e.g. point out to tools (if exist) for the
main configuration loaders (I only used YAML so I don't know about any
other, if they exist).

My 2c,

    Flavio.


More information about the Dancer-users mailing list