Error handling
Contents
[
Hide
]
Aspose.OMR for Java offers an easy-to-use method for detecting errors in form’s source code. Use getErrorCode()
, getErrorMessage()
or getWarnings()
methods of the GenerationResult
object returned by the form generator.
Method | Type | Description |
---|---|---|
getErrorCode() |
int |
If the returned value is 0 , the source code is valid and the printable form can be saved. |
getErrorMessage() |
string |
Human-readable error details. |
getWarnings() |
List<String> |
Human-readable warning messages describing non-critical problems. |
Alternatively, you can catch an exception when saving the from.
Example
OmrEngine engine = new OmrEngine();
GenerationResult res = engine.generateTemplate("source.txt");
if(res.getErrorCode() == 0)
{
res.Save("target", "omr_form");
}
else
{
System.out.println(res.getErrorMessage());
}