PowerBuilder · Exception

DivideByZeroError System Exception

What does DivideByZeroError System Exception mean in PowerBuilder?

PowerBuilder throws this unchecked RuntimeError descendant when a script divides a numeric value by zero, most often inside an arithmetic expression built from user input or an unvalidated calculated column. It is thrown automatically by the PBVM at the point of division and does not need to be declared or explicitly raised.

DivideByZeroError System ExceptionPowerBuilder Classic · Appeon PowerBuilder

Condition

PowerBuilder throws this unchecked RuntimeError descendant when a script divides a numeric value by zero, most often inside an arithmetic expression built from user input or an unvalidated calculated column. It is thrown automatically by the PBVM at the point of division and does not need to be declared or explicitly raised.

Fix

Wrap the division in a TRY/CATCH block scoped to DivideByZeroError so the message and routine name can be logged, and validate the denominator before dividing rather than relying solely on the catch. Use GetMessage() on the caught object to surface the failing routine to diagnostics.

Related exception