[Dancer-users] User-friendly errors on YAML parsing failures (was: Re: dancer croaking with a strange error in config.yml)

damien krotkine dkrotkine at gmail.com
Tue Nov 15 10:55:23 CET 2011


At least, having a regular croak instead of confess will help. I still
think there is no harm to *try* to parse the message to find the
line/column, and include this information in the added Dancer message
if available.

On 15 November 2011 10:51, Philippe Bruhat (BooK)
<philippe.bruhat at free.fr> wrote:
> On Tue, Nov 15, 2011 at 11:46:01AM +0200, sawyer x wrote:
>> On Tue, Nov 15, 2011 at 11:42 AM, damien krotkine
>> <dkrotkine at gmail.com>wrote:
>>
>> >
>> > try to parse the config file. If it fails, try to parse the error
>> > message sent by YAML, and extract the line / column from the
>> > message. It's usually reported accurately. Then 2 cases : if
>> > Carp::Verbose is false (general case), perform a croak (not a
>> > confess), with a human message saying " failed to parse config file
>> > '$filename', at line 42, column 12. Take extra care to spaces and
>> > tabs, blabla". If Carp::Verbose is true, then do a confess instead,
>> > appending the full YAML message.
>> >
>>
>> Disagree. We shouldn't be trying to parse error messages of other
>> modules. You cannot be sure it will be consistent between versions or
>> between engines or between modules.
>>
>> We should be outputting a "Reading your configuration file failed.
>> This was the error message: $msg\n" Something like that, no more.
>
> I agree with Sawyer.
>
> This is also the simplest code change that can possibly be done.
> Along with the doc changes discussed before (either in Dancer::Config
> or in a FAQ entry), that should solve a great deal of YAML-related issues.
>
> --
>  Philippe Bruhat (BooK)
>
>  In war, the only winners are those who sell the weapons.
>                                                 (Moral from Groo #3 (Image))
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>


More information about the Dancer-users mailing list