summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2012-09-20 16:31:59 +0300
committerMarc Englund <marc@vaadin.com>2012-09-20 16:31:59 +0300
commit0a5795024d589ce09ebe6fc0179a9665826ca6e1 (patch)
tree72e3cb713adebf82f93c8c347282b07606bde6ff
parent6335562c72fb193a2835a3a09b617aa6c90efea6 (diff)
downloadvaadin-framework-0a5795024d589ce09ebe6fc0179a9665826ca6e1.tar.gz
vaadin-framework-0a5795024d589ce09ebe6fc0179a9665826ca6e1.zip
SassCompiler: better error-reporting, for e.g #9589 and generally useful. (applied patch)
-rw-r--r--theme-compiler/src/com/vaadin/sass/ScssStylesheet.java2
-rw-r--r--theme-compiler/src/com/vaadin/sass/handler/SCSSErrorHandler.java33
2 files changed, 35 insertions, 0 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
index e2ffe060bc..ccbb22a2c3 100644
--- a/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
+++ b/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
@@ -27,6 +27,7 @@ import org.w3c.css.sac.InputSource;
import com.vaadin.sass.handler.SCSSDocumentHandler;
import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
+import com.vaadin.sass.handler.SCSSErrorHandler;
import com.vaadin.sass.parser.Parser;
import com.vaadin.sass.resolver.ScssStylesheetResolver;
import com.vaadin.sass.resolver.VaadinResolver;
@@ -81,6 +82,7 @@ public class ScssStylesheet extends Node {
}
Parser parser = new Parser();
+ parser.setErrorHandler(new SCSSErrorHandler());
parser.setDocumentHandler(handler);
parser.parseStyleSheet(source);
diff --git a/theme-compiler/src/com/vaadin/sass/handler/SCSSErrorHandler.java b/theme-compiler/src/com/vaadin/sass/handler/SCSSErrorHandler.java
new file mode 100644
index 0000000000..9aac12d707
--- /dev/null
+++ b/theme-compiler/src/com/vaadin/sass/handler/SCSSErrorHandler.java
@@ -0,0 +1,33 @@
+package com.vaadin.sass.handler;
+
+import org.w3c.css.sac.CSSException;
+import org.w3c.css.sac.CSSParseException;
+import org.w3c.css.sac.ErrorHandler;
+
+public class SCSSErrorHandler implements ErrorHandler {
+
+ @Override
+ public void error(CSSParseException arg0) throws CSSException {
+ System.out.println("Error when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+ @Override
+ public void fatalError(CSSParseException arg0) throws CSSException {
+ System.out.println("FATAL Error when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+ @Override
+ public void warning(CSSParseException arg0) throws CSSException {
+ System.out.println("Warning when parsing file \n" + arg0.getURI()
+ + " on line " + arg0.getLineNumber() + ", column "
+ + arg0.getColumnNumber());
+ System.out.println(arg0.getMessage() + "\n");
+ }
+
+}