1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-19 13:54:23 +01:00

Creating a custom error message for missing SPI.h (because we changed the Ethernet library to rely on it). issue #337

This commit is contained in:
David A. Mellis 2010-08-28 09:33:37 +00:00
parent a48d96ee49
commit e3856766c6

View File

@ -354,16 +354,25 @@ public class Compiler implements MessageConsumer {
if (pieces != null) {
RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1);
if (e != null) {
// replace full file path with the name of the sketch tab (unless we're
// in verbose mode, in which case don't modify the compiler output)
if (e != null && !verbose) {
SketchCode code = sketch.getCode(e.getCodeIndex());
String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName();
if (!verbose) s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
if (exception == null) {
exception = e;
exception.hideStackTrace();
}
s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage();
}
if (pieces[3].trim().equals("SPI.h: No such file or directory")) {
e = new RunnerException("Import the SPI library from the Sketch menu.");
s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." +
"\nPlease import it from the Sketch > Import Library menu.";
}
if (exception == null && e != null) {
exception = e;
exception.hideStackTrace();
}
}
System.err.print(s);