Roger Blanchard
447 posts
Registered:
29 Jun 2018
25 Jan 2021
Link to this post
When using the InokeTaskAsync how can you trap any error thrown from the backend. For example, I am using the method below and when the method is called it always say compete with no errors even if an error is being thrown from the backend.
Is there a different way to do this?
METHOD PUBLIC VOID AsyncTaskCompletedHandler( sender AS Progress.Lang.Object,
e AS AsyncTaskCompletedEventArgs
):
DEFINE VARIABLE iErrorAS Progress.Lang.Error NO-UNDO.
DO ON ERROR UNDO, THROW:
MESSAGE
"Cancelled=" e:RequestHandle:Cancelled SKIP
"Complete=" e:RequestHandle:Complete SKIP
"Error=" e:RequestHandle:Error SKIP
"VALID-OBJECT(e:RequestHandle:ERROR-OBJECT)=" VALID-OBJECT(e:RequestHandle:ERROR-OBJECT)
VIEW-AS ALERT-BOX.
IF VALID-OBJECT(e:RequestHandle:ERROR-OBJECT) THEN
DO:
iError = CAST (e:RequestHandle:ERROR-OBJECT, Progress.Lang.Error).
MESSAGE iError:GetMessage(1) VIEW-AS ALERT-BOX.
END.
END.
RETURN.
END METHOD.