HMPDERRH ;SLC/AGP,ASMR/RRB - HMP Error Handler;3/21/12 5:44pm
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
;Per VA Directive 6402, this routine should not be modified.
;
Q
;
ERRHDLR ; -- save errors to return in JSON [Expects ERRPAT, ERRMSG]
N ERROR S ERROR=$$EC^%ZOSV
;
;Ignore the "errors" the unwinder creates.
I ERROR["ZTER" D UNWIND^%ZTER
;
;Make sure we don't loop if there is an error during processing of
;the error handler.
N $ET S $ET="D ^%ZTER,UNWIND^%ZTER"
;
;Save the error then put it in the error trap, this saves the correct
;last global reference.
D ^%ZTER
;
N CNT,MSGCNT
S CNT=+$G(^TMP($J,"HMP ERROR","# of Errors"))
S CNT=CNT+1,^TMP($J,"HMP ERROR","# of Errors")=CNT
S MSGCNT=+$O(^TMP($J,"HMP ERROR","ERROR MESSAGE",""))
I $G(ERRPAT)>0,MSGCNT=0 S MSGCNT=MSGCNT+1,^TMP($J,"HMP ERROR","ERROR MESSAGE",MSGCNT)="An error occurred on patient: "_$G(ERRPAT)
I $L($G(ERRMSG))>0 S MSGCNT=MSGCNT+1,^TMP($J,"HMP ERROR","ERROR MESSAGE",MSGCNT)=ERRMSG
;I $D(ERRARRY) D
;.S DOMCNT=$O(^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",""))+1
;.I $D(ERRARRY)>0 M ^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",DOMCNT)=ERRARRY
;if unwind I lose the entire process, which returns incomplete data to the extract return value.
;D GTQ^HMPDJ
D UNWIND^%ZTER
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPDERRH 1329 printed Dec 13, 2024@01:53:08 Page 2
HMPDERRH ;SLC/AGP,ASMR/RRB - HMP Error Handler;3/21/12 5:44pm
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**;Sep 01, 2011;Build 63
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
ERRHDLR ; -- save errors to return in JSON [Expects ERRPAT, ERRMSG]
+1 NEW ERROR
SET ERROR=$$EC^%ZOSV
+2 ;
+3 ;Ignore the "errors" the unwinder creates.
+4 IF ERROR["ZTER"
DO UNWIND^%ZTER
+5 ;
+6 ;Make sure we don't loop if there is an error during processing of
+7 ;the error handler.
+8 NEW $ETRAP
SET $ETRAP="D ^%ZTER,UNWIND^%ZTER"
+9 ;
+10 ;Save the error then put it in the error trap, this saves the correct
+11 ;last global reference.
+12 DO ^%ZTER
+13 ;
+14 NEW CNT,MSGCNT
+15 SET CNT=+$GET(^TMP($JOB,"HMP ERROR","# of Errors"))
+16 SET CNT=CNT+1
SET ^TMP($JOB,"HMP ERROR","# of Errors")=CNT
+17 SET MSGCNT=+$ORDER(^TMP($JOB,"HMP ERROR","ERROR MESSAGE",""))
+18 IF $GET(ERRPAT)>0
IF MSGCNT=0
SET MSGCNT=MSGCNT+1
SET ^TMP($JOB,"HMP ERROR","ERROR MESSAGE",MSGCNT)="An error occurred on patient: "_$GET(ERRPAT)
+19 IF $LENGTH($GET(ERRMSG))>0
SET MSGCNT=MSGCNT+1
SET ^TMP($JOB,"HMP ERROR","ERROR MESSAGE",MSGCNT)=ERRMSG
+20 ;I $D(ERRARRY) D
+21 ;.S DOMCNT=$O(^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",""))+1
+22 ;.I $D(ERRARRY)>0 M ^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",DOMCNT)=ERRARRY
+23 ;if unwind I lose the entire process, which returns incomplete data to the extract return value.
+24 ;D GTQ^HMPDJ
+25 DO UNWIND^%ZTER
+26 QUIT