Structured Errors for engine loading #836

Closed
pdl opened this Issue Oct 1, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

pdl commented Oct 1, 2012

In list context, Dancer::ModuleLoader returns an error as well as a result flag.

However, in Dancer::Engine, this useful feature is not used:

    raise core_engine => "unable to load $type engine '$name', "
      . "perhaps you need to install $engine_class?"
      unless Dancer::ModuleLoader->load($engine_class);

Is there a way to fix this?

I guess it's just a matter of somthing like the following, but I don't know if it fits with Dancer's 'style' of handling/nesting errors.

    my ($load_result, $load_error) =  unless Dancer::ModuleLoader->load($engine_class);
    raise core_engine => "unable to load $type engine '$name', "
      . "perhaps you need to install $engine_class?\n"
      .  $load_error unless $load_result;

@yanick yanick added a commit that referenced this issue Jul 22, 2013

@yanick yanick display why the loading failed if it does
with the additional tip if the module was not found

Fixes #836
4ad66fc

yanick referenced this issue Jul 22, 2013

Closed

Detailed error #939

yanick closed this in a41cfbb Jul 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment