ONCXERR ;HCIOFO/SG - HTTP AND WEB SERVICES (ERRORS) ; 6/21/04 2:35pm
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
Q
;
;***** GENERATES THE ERROR MESSAGE
;
; ERRCODE Error code
;
; [[.]INFO] reserved
;
; [ARG1-ARG5] Optional parameters as for $$MSG^ONCXERR
;
; Return Values:
; <0 Error code^Message Text^Label+Offset^Routine
; 0 Ok (if ERRCOCE'<0)
;
ERROR(ERRCODE,INFO,ARG1,ARG2,ARG3,ARG4,ARG5) ;
Q:ERRCODE'<0 0
N PLACE,SL
S SL=$STACK(-1)-1
F Q:SL'>0 D Q:'(PLACE["^ONCXERR") S SL=SL-1
. S PLACE=$P($STACK(SL,"PLACE")," ")
S:PLACE'[U PLACE=U
Q ERRCODE_U_$$MSG(ERRCODE,,.ARG1,.ARG2,.ARG3,.ARG4,.ARG5)_U_PLACE
;
;***** RETURNS THE TEXT OF THE MESSAGE
;
; ERRCODE Error code
;
; [.TYPE] Type of the error
;
; [ARG1-ARG5] Optional parameters that substitute the |n| "windows"
; in the text of the message (for example, the |2| will
; be substituted by the value of the ARG2).
;
; NOTE: The "^" is replaced with the "~" in the resulting message.
;
MSG(ERRCODE,TYPE,ARG1,ARG2,ARG3,ARG4,ARG5) ;
S TYPE=6 Q:ERRCODE'<0 ""
N ARG,I1,I2,MSG
;--- Get a descriptor of the message
S I1=-ERRCODE,MSG=$P($T(MSGLIST+I1),";;",2)
S I1=+$TR($P(MSG,U,2)," "),MSG=$P(MSG,U,3,999)
S:I1>0 TYPE=I1
Q:MSG?." " "Unknown error ("_ERRCODE_")"
;--- Substitute parameters
S I1=2
F S I1=$F(MSG,"|",I1-1) Q:'I1 D
. S I2=$F(MSG,"|",I1) Q:'I2
. X "S ARG=$G(ARG"_+$TR($E(MSG,I1,I2-2)," ")_")"
. S $E(MSG,I1-1,I2-1)=ARG
Q $TR($$TRIM^XLFSTR(MSG),U,"~")
;
;***** RETURNS TYPE OF THE MESSAGE
;
; ERRCODE Error code
;
TYPE(ERRCODE) ;
Q:ERRCODE'<0 0
N I,TYPE S I=-ERRCODE
S I=$P($T(MSGLIST+I),";;",2),TYPE=+$TR($P(I,U,2)," ")
Q $S(TYPE>0:TYPE,1:6)
;
;***** LIST OF THE MESSAGES (THERE SHOULD BE NOTHING AFTER THE LIST!)
;
; The error codes are provided in the table only for clarity.
; Text of the messages are extracted using the $TEXT function and
; absolute values of the ERRCODE parameter.
;
; Message Type:
; 1 Debug 4 Warning
; 2 Information 5 Database Error
; 3 Data Quality 6 Error
;
MSGLIST ; Code Type Message Text
;; -1 ^ 6 ^ Missing host name: '|1|'
;; -2 ^ 6 ^ Cannot resolve the host name: '|1|'
;; -3 ^ 6 ^ Cannot connect to host(s): '|1|'
;; -4 ^ 6 ^ Missing redirection URL
;; -5 ^ 6 ^ Too many redirections
;; -6 ^ 6 ^ Error during transaction (see Error Trap log)
;; -7 ^ 6 ^ Timeout
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCXERR 2575 printed Dec 13, 2024@02:29:20 Page 2
ONCXERR ;HCIOFO/SG - HTTP AND WEB SERVICES (ERRORS) ; 6/21/04 2:35pm
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 QUIT
+4 ;
+5 ;***** GENERATES THE ERROR MESSAGE
+6 ;
+7 ; ERRCODE Error code
+8 ;
+9 ; [[.]INFO] reserved
+10 ;
+11 ; [ARG1-ARG5] Optional parameters as for $$MSG^ONCXERR
+12 ;
+13 ; Return Values:
+14 ; <0 Error code^Message Text^Label+Offset^Routine
+15 ; 0 Ok (if ERRCOCE'<0)
+16 ;
ERROR(ERRCODE,INFO,ARG1,ARG2,ARG3,ARG4,ARG5) ;
+1 if ERRCODE'<0
QUIT 0
+2 NEW PLACE,SL
+3 SET SL=$STACK(-1)-1
+4 FOR
if SL'>0
QUIT
Begin DoDot:1
+5 SET PLACE=$PIECE($STACK(SL,"PLACE")," ")
End DoDot:1
if '(PLACE["^ONCXERR")
QUIT
SET SL=SL-1
+6 if PLACE'[U
SET PLACE=U
+7 QUIT ERRCODE_U_$$MSG(ERRCODE,,.ARG1,.ARG2,.ARG3,.ARG4,.ARG5)_U_PLACE
+8 ;
+9 ;***** RETURNS THE TEXT OF THE MESSAGE
+10 ;
+11 ; ERRCODE Error code
+12 ;
+13 ; [.TYPE] Type of the error
+14 ;
+15 ; [ARG1-ARG5] Optional parameters that substitute the |n| "windows"
+16 ; in the text of the message (for example, the |2| will
+17 ; be substituted by the value of the ARG2).
+18 ;
+19 ; NOTE: The "^" is replaced with the "~" in the resulting message.
+20 ;
MSG(ERRCODE,TYPE,ARG1,ARG2,ARG3,ARG4,ARG5) ;
+1 SET TYPE=6
if ERRCODE'<0
QUIT ""
+2 NEW ARG,I1,I2,MSG
+3 ;--- Get a descriptor of the message
+4 SET I1=-ERRCODE
SET MSG=$PIECE($TEXT(MSGLIST+I1),";;",2)
+5 SET I1=+$TRANSLATE($PIECE(MSG,U,2)," ")
SET MSG=$PIECE(MSG,U,3,999)
+6 if I1>0
SET TYPE=I1
+7 if MSG?." "
QUIT "Unknown error ("_ERRCODE_")"
+8 ;--- Substitute parameters
+9 SET I1=2
+10 FOR
SET I1=$FIND(MSG,"|",I1-1)
if 'I1
QUIT
Begin DoDot:1
+11 SET I2=$FIND(MSG,"|",I1)
if 'I2
QUIT
+12 XECUTE "S ARG=$G(ARG"_+$TRANSLATE($EXTRACT(MSG,I1,I2-2)," ")_")"
+13 SET $EXTRACT(MSG,I1-1,I2-1)=ARG
End DoDot:1
+14 QUIT $TRANSLATE($$TRIM^XLFSTR(MSG),U,"~")
+15 ;
+16 ;***** RETURNS TYPE OF THE MESSAGE
+17 ;
+18 ; ERRCODE Error code
+19 ;
TYPE(ERRCODE) ;
+1 if ERRCODE'<0
QUIT 0
+2 NEW I,TYPE
SET I=-ERRCODE
+3 SET I=$PIECE($TEXT(MSGLIST+I),";;",2)
SET TYPE=+$TRANSLATE($PIECE(I,U,2)," ")
+4 QUIT $SELECT(TYPE>0:TYPE,1:6)
+5 ;
+6 ;***** LIST OF THE MESSAGES (THERE SHOULD BE NOTHING AFTER THE LIST!)
+7 ;
+8 ; The error codes are provided in the table only for clarity.
+9 ; Text of the messages are extracted using the $TEXT function and
+10 ; absolute values of the ERRCODE parameter.
+11 ;
+12 ; Message Type:
+13 ; 1 Debug 4 Warning
+14 ; 2 Information 5 Database Error
+15 ; 3 Data Quality 6 Error
+16 ;
MSGLIST ; Code Type Message Text
+1 ;; -1 ^ 6 ^ Missing host name: '|1|'
+2 ;; -2 ^ 6 ^ Cannot resolve the host name: '|1|'
+3 ;; -3 ^ 6 ^ Cannot connect to host(s): '|1|'
+4 ;; -4 ^ 6 ^ Missing redirection URL
+5 ;; -5 ^ 6 ^ Too many redirections
+6 ;; -6 ^ 6 ^ Error during transaction (see Error Trap log)
+7 ;; -7 ^ 6 ^ Timeout