[Dancer-users] User-friendly errors on YAML parsing failures (was: Re: dancer croaking with a strange error in config.yml)
Mr. Puneet Kishor
punk.kish at gmail.com
Mon Nov 14 17:55:16 CET 2011
On Nov 14, 2011, at 10:11 AM, David Precious wrote:
> On Monday 14 November 2011 15:33:19 Mr. Puneet Kishor wrote:
>> Solved... (it was an invisible character, but see below) --
>> Opened the file again in vi and `:set list`, and bingo! there was a
>> character that looked like ^I, a result of pressing 'tab'
>> Seems like YAML doesn't like tabs. I deleted that character, and now
>> everything is well.
> Ah, good stuff, glad to hear you got it sorted.
> I'm beginning to wonder if we should add a little magic to Dancer to catch
> YAML parsing errors, and, at the very least, output a message making it
> clearer that the problem is not with Dancer but that YAML.pm couldn't parse
> the YAML and provide a link to the YAML spec, and perhaps also, look for any
> tabs in the file (before any non-whitespace chars) and, if found, output a "It
> looks like you've got tabs in the file; don't do that" message.
In my view, none of the above is necessary. What is more important is to have this information in the config file docs "NO TABS; FINAL NEWLINE" along with a sample config file.
Now that I know that hidden tabs were causing the program to croak, I will make sure they never occur again, or, if they do by mistake, then I know how to fix the error.
More information about the Dancer-users