The returnerror statement passes an error back to the current subroutines calling procedure.


This statement has one parameter:

message – is the text of the error message.


The returnerror statement ends the current subroutine immediately and generates an error. If desired, the calling procedure can handle the error with the if error, try or catch statements (see Error Handling. If the calling procedure does not handle the error, Panorama will simply stop the procedure and display the specified error message.

Here is an example procedure which we will call AdjustInventory. It adjusts the inventory level if there are enough items in stock to fulfill the order. If there aren’t enough items in stock, an error message is generated.

if OnHand < parameter(1)
    returnerror "Insufficient stock on hand"

If this subroutine is called normally, an error message will be displayed if there is not enough stock.

call AdjustInventory,4
call FinishOrder // if there is not enough stock on hand, FinishOrder will not be called

We could revise this program to delete the line item and finish the order if there is not enough stock on hand.

call AdjustInventory,4
if error
    call RemoveLineItem
call FinishOrder

With this revision the program will never display an error message for insufficient stock, and the FinishOrder subroutine will always be called.

See Also


10.0UpdateCarried over from Panorama 6.0, but now has two names: RETURNERROR and RTNERROR. Either will work.