I have some inline java code that looks like this:
When it throws an error, the result is a very long stack trace in my B4J log. I would prefer to customize it so I have a single line in the log (e.g. "error thrown: Fieldkey does not exist").
Is there a simple way to do I do this?
What is the best way to handle exceptions with in-line java code?
B4X:
public static void setTagContents(Tag tag, FieldKey fieldkey, String sContents) {
try {
if (sContents.length() > 0) {
if (!tag.hasField(fieldkey)) {
tag.addField(fieldkey, sContents);
} else {
tag.setField(fieldkey, sContents);
}
}
}
catch (Throwable e) {
e.printStackTrace();
}
}
Is there a simple way to do I do this?
What is the best way to handle exceptions with in-line java code?