-
Notifications
You must be signed in to change notification settings - Fork 465
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
@error is non fatal (should be fatal, is inconsistent with custom functions) #967
Comments
This should probably be fixed for 3.2.0. Is that possible @mgreter ? |
I need at least a sample SCSS code, OS and compiler version to debug this any further! To be honest, I don't even get OPs problem, since without returning an error he seems to get |
If I'm understanding correctly. Executing the following via the C API produced the expected Sass a { @error 'foo'; } However creating a custom function which throws a
It appears that $ sass test.scss
Error: bar
on line 2 of test.scss
Use --trace for backtrace.
$ echo $?
65
$ sassc test.scss
Error: bar
on line 1 of test.scss
$ echo $?
0 |
Ah, now I understand, but I wonder if this is the expected behavior. I guess this also should be part of our roadmap to support error spec tests (we should somehow include the expected exit status there). Just to let everyone know, mingw has a problem when it throws native errors (like IMO this is a pretty minor bug and I'm not sure if we can address this in 3.2 beta. |
This is pretty important for our build as we use |
I agree with @asottile this is really important. People using Sassc in their CI environments need to know if their Sass failed to compile. That almost always done by looking for non-zero exit code. I don't think the code itself matters, as long as it's non-zero. |
At the very least the sassc example I showed is critical IMO. |
I ACK that this is probably not working as expected, but as I said, you're using experimental features here. In order to be able to stabilize such features, we need users like you that run into such traps we didn't anticipate! IMO we have more important regressions to address in this beta and I'm pretty sure this bug was existing since its introduction. I hope this doesn't offend you, since it only means a re-scoping for that issue. And by your original examples, I would guess you have a pretty good knowledge of c/c++! So would like to encourage you to take look at the code, maybe you're able to solve you're problem on your own and provide a PR to libsass! |
@xzyfer we are IMO only talking about returning errors from custom functions! So this should not touch sassc by any means! |
Sorry for not being clear, this is a problem in sassc with the latest Libsass. foo {
@error("bar");
} $ sass test.scss
Error: bar
on line 2 of test.scss
Use --trace for backtrace.
$ echo $?
65
$ sassc test.scss
Error: bar
on line 1 of test.scss
$ echo $?
0 Maybe it's a separate issue, but at the very least I see this use case as critical. |
You're sure that wasn't the same before? |
Looks like it's always been that way, but |
@xzyfer you mean for custom functions, or by actual "first appearance"? |
The sass As you said custom functions are experimental so I'm not concerned. SassC however isn't. |
OK, got it now :) IMO let's first asses how difficult it is to fix, before adding a milestone again! But yeah, it should be a pretty trivial fix in this case 😉 (error status is set in sass_context ...). |
IMO we should aim to get this in 3.2.0. Without it SassC is pretty much useless for companies with CI environments, because there's not clear way to determine if compilation failed. But yes, if it's too difficult to fix we'll have to figure out a way forward for SassC at least. |
I do agree, but to be honest I would expect a company to have one guy submitting a PR to solve their problem. IMO we now have a very active merge policy, so we should encourage participation by companies in exactly this way. That's probably my personal opinion, but if companies want to use this software, they should at least be willing to contribute a little back; If they encounter a problem they can solve in one or two days, they should just do that and submit a PR! |
Sure sure, I'm going to try and look into this myself as well :) |
👍 that's great news! And if you need any further help, feel free to ask. I would start somewhere in |
Yep I'm pretty familiar with the interface ( I implemented python bindings with custom functions for 3.1.0 here: https://github.com/dahlia/libsass-python/pull/44/files ). I'll hopefully have something by end of tonight. |
How should I regression test this? |
To be honest, manually! We don't have any other means to test this currently (and exit code probably is second prio after beeing able to spec test error messages on stderr). The only thing I could offer is that you put your test into perl-libsass. |
I'm running against current master: c15b384
The following:
Produces:
However this code (using custom functions):
Produces:
The same is reproduced for
@warn
as well (fatal in custom functions, nonfatal outside).Prior art:
@error
nodes and does not fail on@warning
nodesThe text was updated successfully, but these errors were encountered: