Skip to content

Commit e385676

Browse files
committed
Creating a custom error message for missing SPI.h (because we changed the Ethernet library to rely on it). issue #337
1 parent a48d96e commit e385676

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

app/src/processing/app/debug/Compiler.java

+16-7
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,25 @@ public void message(String s) {
354354

355355
if (pieces != null) {
356356
RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1);
357-
358-
if (e != null) {
357+
358+
// replace full file path with the name of the sketch tab (unless we're
359+
// in verbose mode, in which case don't modify the compiler output)
360+
if (e != null && !verbose) {
359361
SketchCode code = sketch.getCode(e.getCodeIndex());
360362
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
361-
if (!verbose) s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
362-
if (exception == null) {
363-
exception = e;
364-
exception.hideStackTrace();
365-
}
363+
s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
366364
}
365+
366+
if (pieces[3].trim().equals("SPI.h: No such file or directory")) {
367+
e = new RunnerException("Import the SPI library from the Sketch menu.");
368+
s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
369+
"\nPlease import it from the Sketch > Import Library menu.";
370+
}
371+
372+
if (exception == null && e != null) {
373+
exception = e;
374+
exception.hideStackTrace();
375+
}
367376
}
368377

369378
System.err.print(s);

0 commit comments

Comments
 (0)