Include the underlying error's message in source map input errors.
Currently JSCompiler just reports:
WARNING - Failed to parse malformed sourcemap: path/to/some/file.js.map
This will change it to report something like:
WARNING - Failed to parse malformed sourcemap in path/to/some/file.js.map: illegal character ...
@@ -33,10 +33,11 @@ public final class SourceMapInput implements Serializable {
private transient volatile boolean cached = false;
static final DiagnosticType SOURCEMAP_RESOLVE_FAILED =
- DiagnosticType.warning("SOURCEMAP_RESOLVE_FAILED", "Failed to resolve sourcemap: {0}");
+ DiagnosticType.warning("SOURCEMAP_RESOLVE_FAILED", "Failed to resolve sourcemap at {0}: {1}");
static final DiagnosticType SOURCEMAP_PARSE_FAILED =
- DiagnosticType.warning("SOURCEMAP_PARSE_FAILED", "Failed to parse malformed sourcemap: {0}");
+ DiagnosticType.warning(
+ "SOURCEMAP_PARSE_FAILED", "Failed to parse malformed sourcemap in {0}: {1}");
public SourceMapInput(SourceFile sourceFile) {
this.sourceFile = sourceFile;
@@ -57,10 +58,12 @@ public final class SourceMapInput implements Serializable {
consumer.parse(sourceMapContents);
parsedSourceMap = consumer;
} catch (IOException e) {
- JSError error = JSError.make(SourceMapInput.SOURCEMAP_RESOLVE_FAILED, sourceMapPath);
+ JSError error =
+ JSError.make(SourceMapInput.SOURCEMAP_RESOLVE_FAILED, sourceMapPath, e.getMessage());
errorManager.report(error.getDefaultLevel(), error);
} catch (SourceMapParseException e) {
- JSError error = JSError.make(SourceMapInput.SOURCEMAP_PARSE_FAILED, sourceMapPath);
+ JSError error =
+ JSError.make(SourceMapInput.SOURCEMAP_PARSE_FAILED, sourceMapPath, e.getMessage());
errorManager.report(error.getDefaultLevel(), error);
}
}
