Wrap exceptions thrown by class builders and add details about class file being generated.
This commit is contained in:
@@ -286,13 +286,23 @@ public class ClassFileFactory implements OutputFileCollection {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public byte[] asByteArray() {
|
public byte[] asByteArray() {
|
||||||
return generators.get(relativeClassFilePath).asBytes(builderFactory);
|
try {
|
||||||
|
return generators.get(relativeClassFilePath).asBytes(builderFactory);
|
||||||
|
}
|
||||||
|
catch (RuntimeException e) {
|
||||||
|
throw new RuntimeException("Error generating class file " + this.toString() + ": " + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String asText() {
|
public String asText() {
|
||||||
return generators.get(relativeClassFilePath).asText(builderFactory);
|
try {
|
||||||
|
return generators.get(relativeClassFilePath).asText(builderFactory);
|
||||||
|
}
|
||||||
|
catch (RuntimeException e) {
|
||||||
|
throw new RuntimeException("Error generating class file " + this.toString() + ": " + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user