/
How do I throw an exception?
How do I throw an exception?
Question
Just throw a new Exception("Xxx")? That gives me Unexpected type: java.lang.Exception. Is there some exception class I can use for this?
Answer
Use throwException(String errorMessage)
For details see: https://developer.pricefx.eu/pricefx-api/groovy/develop/net/pricefx/formulaengine/scripting/PublicGroovyAPI.html#throwException-java.lang.String-
A calculation logic can stop its execution and fail by throwing an exception, for example:
if (api.userEntry("margin") <0)
then api.throwException("I won't let you go bankrupt")
else price=cost+margin
, multiple selections available,
Related content
When working with the Excel Client, what is the worksheet size limit?
When working with the Excel Client, what is the worksheet size limit?
Read with this
Error Management (Agreements)
Error Management (Agreements)
More like this
How can I get better search results here?
How can I get better search results here?
Read with this
Data Validation
Data Validation
More like this
How to add a manual editable attribute in a LPG, based on restricted fields (like the "option()" in Java for quotes?
How to add a manual editable attribute in a LPG, based on restricted fields (like the "option()" in Java for quotes?
Read with this
Configuration Tips - Customer/Product Extensions
Configuration Tips - Customer/Product Extensions
Read with this
Found an issue in documentation? Write to us.