Skip to content

RequireJS error callback not used for CoffeeScript not found errors. #39

Open

Description

@guybedford

If I try to load a CoffeeScript file that doesn't exist:

  require(['cs!some/module'], function(m) {
  }, function(err) {
    console.log(err.toString());
  });

then instead of the error callback catching it, it throws the error entirely. Ideally, the same error callback could be triggered.

The error message is:

  Uncaught Error: fromText eval for some/module failed: ReferenceError: Not is not defined 

Activity

  1. jrburke commented on Dec 6, 2012

    @jrburke
    Member

    Right, looks like this plugin is not using the load.onerror functionality. If you want to work up a patch, you can look at the text plugin for inspiration. Specifically:

    https://github.com/requirejs/text/blob/master/text.js#L165

    shows passing an errback function to text.get (which is called fetchText in this plugin), and then fetchText in this plugin would need to be modified to call the errback function on a failure.

  2. guybedford commented on Dec 7, 2012

    @guybedford
    ContributorAuthor

    Ok great I will get to this along with the xhr hooks, although it may be another week or so yet before I can get down to it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions