Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-sass compat: async errors for sass functions #590

Closed
chriseppstein opened this issue Feb 11, 2019 · 2 comments
Closed

node-sass compat: async errors for sass functions #590

chriseppstein opened this issue Feb 11, 2019 · 2 comments
Labels
bug JavaScript Issues particular to the Node.js distribution

Comments

@chriseppstein
Copy link

chriseppstein commented Feb 11, 2019

In node-sass you return a value of type sass.types.Error if you want to communicate a failure that occurred during function execution back to the sass compiler. In dart-sass, there's no sass.types.Error constructor. According to @nex3, dart-sass expects an instance of the standard js Error object, but returning a standard error object to node-sass fails with error in C function eyeglass-fs-info: A SassValue object was expected.

@chriseppstein chriseppstein changed the title a node-sass compat: async errors Feb 11, 2019
@chriseppstein
Copy link
Author

example code:

let sassOptions = {
  "functions": {
    "raise-error($wait-time)": function(waitTime, cb) {
      setTimeout(function() {
        cb(new sass.types.Error("An Error!"));
      }, waitTime.getValue());
    }
  }
};

@chriseppstein chriseppstein changed the title node-sass compat: async errors node-sass compat: async errors for sass functions Feb 11, 2019
@nex3 nex3 added bug JavaScript Issues particular to the Node.js distribution labels Feb 12, 2019
@nex3
Copy link
Contributor

nex3 commented Mar 16, 2019

The hilarious thing here is that passing an Error to an importer's callback works in Node Sass, but passing a sass.types.Error does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug JavaScript Issues particular to the Node.js distribution
Projects
None yet
Development

No branches or pull requests

2 participants