Search code examples
triggersprogress-4glopenedgethrow

Throw an error from an OpenEdge UI trigger to the main program


I'm struggling to propagate an system error object from a UI trigger to the main program.

  ON CHOOSE OF btnButton IN FRAME frmFrame
  DO:

     /* this will cause a system error */
     FIND FIRST Customer NO-LOCK
          WHERE Customer.CustNum = 1875918759178.

     CATCH eErr AS Progress.Lang.SysError:
        /* It does get caught over here */
        UNDO, THROW eErr.
     END CATCH.
  END.

  CATCH eMain AS Progress.Lang.SysError:
     /* this message doesn't happen */
     MESSAGE
        "caught"
        VIEW-AS ALERT-BOX.
  END CATCH.

It doesn't seem to want to propagate the error object though. Any ideas?


Solution

  • From the documentation on THROW option, Undo Statement:

    "UNDO, THROW is not allowed in a CATCH block of a user interface trigger. The ABL does not you to raise or RETURN error out of a user interface trigger. To do so will result in a compile-time error. " The sentence above says "Does not you to..." I believe it should be "does not allow you to". But the documentation itself is wrong.

    Anyway, it seems what you're trying to accomplish is not yet possible as of today (Dec,27,2016).