Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HMPDERRH

HMPDERRH.m

Go to the documentation of this file.
  1. 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
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. ERRHDLR ; -- save errors to return in JSON [Expects ERRPAT, ERRMSG]
  1. N ERROR S ERROR=$$EC^%ZOSV
  1. ;
  1. ;Ignore the "errors" the unwinder creates.
  1. I ERROR["ZTER" D UNWIND^%ZTER
  1. ;
  1. ;Make sure we don't loop if there is an error during processing of
  1. ;the error handler.
  1. N $ET S $ET="D ^%ZTER,UNWIND^%ZTER"
  1. ;
  1. ;Save the error then put it in the error trap, this saves the correct
  1. ;last global reference.
  1. D ^%ZTER
  1. ;
  1. N CNT,MSGCNT
  1. S CNT=+$G(^TMP($J,"HMP ERROR","# of Errors"))
  1. S CNT=CNT+1,^TMP($J,"HMP ERROR","# of Errors")=CNT
  1. S MSGCNT=+$O(^TMP($J,"HMP ERROR","ERROR MESSAGE",""))
  1. I $G(ERRPAT)>0,MSGCNT=0 S MSGCNT=MSGCNT+1,^TMP($J,"HMP ERROR","ERROR MESSAGE",MSGCNT)="An error occurred on patient: "_$G(ERRPAT)
  1. I $L($G(ERRMSG))>0 S MSGCNT=MSGCNT+1,^TMP($J,"HMP ERROR","ERROR MESSAGE",MSGCNT)=ERRMSG
  1. ;I $D(ERRARRY) D
  1. ;.S DOMCNT=$O(^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",""))+1
  1. ;.I $D(ERRARRY)>0 M ^TMP($J,"HMP ERROR",ERRPAT,ERRDOM,"DATA",DOMCNT)=ERRARRY
  1. ;if unwind I lose the entire process, which returns incomplete data to the extract return value.
  1. ;D GTQ^HMPDJ
  1. D UNWIND^%ZTER
  1. Q