use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.
the class JsErrorMessageTest method testStrangeErrorName.
public void testStrangeErrorName() throws Exception {
String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1: Uncaught #<Object>";
JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
assertNotNull(errorMessage);
assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
assertEquals(1, errorMessage.getLineNumber());
assertEquals(null, errorMessage.getColumnNumber());
assertEquals("Uncaught Error", errorMessage.getErrorName());
}
use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.
the class JsErrorMessageTest method testName.
public void testName() throws Exception {
String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1: ReferenceError: s is not defined";
JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
assertNotNull(errorMessage);
assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
assertEquals(1, errorMessage.getLineNumber());
assertEquals(null, errorMessage.getColumnNumber());
assertEquals("ReferenceError", errorMessage.getErrorName());
}
use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.
the class JsErrorFilter method applyFilter.
@Nullable
@Override
public Result applyFilter(String line, int entireLength) {
JsErrorMessage message;
try {
message = JsErrorMessage.parseFromText(line, myBasePath);
} catch (Exception e) {
LOG.error("Can't parse error message from '" + line + "'", e);
return null;
}
if (message == null) {
return null;
}
VirtualFile virtualFile = VfsUtil.findFileByIoFile(message.getFileWithError(), false);
if (virtualFile == null || !virtualFile.isValid()) {
return null;
}
int column = ObjectUtils.notNull(message.getColumnNumber(), 0);
HyperlinkInfo hyperlinkInfo = new OpenFileHyperlinkInfo(myProject, virtualFile, message.getLineNumber() - 1, column);
return new Filter.Result(message.getHyperlinkStartInclusiveInd(), message.getHyperlinkEndExclusiveInd(), hyperlinkInfo);
}
Aggregations