ONCSAPIE ;Hines OIFO/SG - COLLABORATIVE STAGING (ERRORS) ; 10/27/06 8:59am
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;;
;
Q
;
;***** INITIALIZES THE ERROR STACK
;
; [ENABLE] Enable error stack (0/1)
;
CLEAR(ENABLE) ;
S:'$D(ENABLE) ENABLE=$D(ONCSAPI("MSG"))#10
K ONCSAPI("MSG") S:ENABLE ONCSAPI("MSG")=""
D CLEAN^DILF
Q
;
;***** CHECKS THE ERRORS AFTER A FILEMAN DBS CALL
;
; ONC8MSG Closed reference of the error messages array
; (from DBS calls)
; [ERRCODE] Error code to assign
; [FILE] File number used in the DBS call
; [IENS] IENS used in the DBS call
;
; The $$DBS^ONCSAPIE function checks the DIERR and @ONC8MSG
; variables for errors after a FileMan DBS call.
;
; Return Values:
;
; If there are no errors found, it returns an empty string.
; In case of errors, the result depends on value of the ERRCODE
; parameter:
;
; If ERRCODE is omitted or equals 0, the function returns a string
; containing the list of error codes separated by comma.
;
; If ERRCODE is not zero, the $$ERROR^ONCSAPIE function is called
; and its return value is returned.
;
; NOTE: This entry point can also be called as a procedure:
; D DBS^ONCSAPIE(...) if you do not need its return value.
;
DBS(ONC8MSG,ERRCODE,FILE,IENS) ;
I '$G(DIERR) Q:$QUIT "" Q
N ERRLST,ERRNODE,I,ONCMSGTEXT
S ERRNODE=$S($G(ONC8MSG)'="":$NA(@ONC8MSG@("DIERR")),1:$NA(^TMP("DIERR",$J)))
I $D(@ERRNODE)<10 Q:$QUIT "" Q
;--- Return a list of errors
I '$G(ERRCODE) D Q:$QUIT $P(ERRLST,",",2,99) Q
. S ERRLST="",I=0
. F S I=$O(@ERRNODE@("E",I)) Q:'I S ERRLST=ERRLST_","_I
. D CLEAN^DILF
;--- Record the error message
D MSG^DIALOG("AE",.ONCMSGTEXT,,,$G(ONC8MSG)),CLEAN^DILF
S I=$S($G(FILE):"; File #"_FILE,1:"")
S:$G(IENS)'="" I=I_"; IENS: """_IENS_""""
S I=$$ERROR(ERRCODE,.ONCMSGTEXT,I)
Q:$QUIT I Q
;
;***** GENERATES THE ERROR MESSAGE
;
; ERRCODE Error code.
; If the 'S' suffix is appended to the code, the error
; descriptor will not be stored into the error stack.
;
; [[.]ONCINFO] Optional additional information (either a string or
; a reference to a local array that contains strings
; prepared for storing in a word processing field)
;
; [ARG1-ARG5] Optional parameters as for $$MSG^ONCSAPIE
;
; Return Values:
; <0 Error code^Message Text^Label+Offset^Routine
; 0 Ok (if ERRCOCE'<0)
;
; NOTE: This entry point can also be called as a procedure:
; D ERROR^ONCSAPIE(...) if you do not need its return value.
;
ERROR(ERRCODE,ONCINFO,ARG1,ARG2,ARG3,ARG4,ARG5) ;
I ERRCODE'<0 Q:$QUIT 0 Q
N IEN,MSG,PLACE,SL,TMP
;--- Get the error location
S SL=$STACK(-1)-1
F Q:SL'>0 D Q:'(PLACE["^ONCSAPIE") S SL=SL-1
. S PLACE=$P($STACK(SL,"PLACE")," ")
S:$G(PLACE)'[U PLACE=U
;--- Prepare the additional information
I $D(ONCINFO)=1 S TMP=ONCINFO K ONCINFO S ONCINFO(1)=TMP
;--- Prepare and store the message descriptor
S MSG=$$MSG(ERRCODE,,.ARG1,.ARG2,.ARG3,.ARG4,.ARG5)
S MSG=(+ERRCODE)_U_MSG_U_PLACE
D:ERRCODE'["S" STORE(MSG,"ONCINFO")
;---
Q:$QUIT MSG Q
;
;***** RETURNS THE TEXT AND TYPE 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,"~")
;
;***** DISPLAYS THE ERROR STACK OR A SINGLE ERROR MESSAGE
;
; [ERROR] Descriptor of a single error to be displayed
;
PRTERRS(ERROR) ;
Q:'$G(ERROR)&($D(ONCSAPI("MSG"))<10)
N EXIT,IMSG,INFONODE,ONCMNL
S ONCMNL=$S($G(IOSL)>3:IOSL-3,1:20),$Y=0
;--- Print table header
D EN^DDIOL("Code",,"!"),EN^DDIOL("Description",,"?6")
D EN^DDIOL("Additional Information",,"!?6")
D EN^DDIOL("Type",,"!?6"),EN^DDIOL("Location",,"?22")
D EN^DDIOL("----",,"!"),EN^DDIOL($$REPEAT^XLFSTR("-",IOM-7),,"?6")
;--- Print a single error message
I $G(ERROR) S EXIT=$$PRT1ERR(ERROR) Q
;--- Print the error stack (most recent messages first)
S IMSG=" ",EXIT=0
F S IMSG=$O(ONCSAPI("MSG",IMSG),-1) Q:IMSG'>0 D Q:EXIT
. S INFONODE=$NA(ONCSAPI("MSG",IMSG,1))
. S EXIT=$$PRT1ERR(ONCSAPI("MSG",IMSG,0),INFONODE)
Q
;
PRT1ERR(ERR,ONC8INFO) ;
N EXIT,I,LOC,TYPE
S LOC=$S($P(ERR,U,4)'="":$P(ERR,U,3,4),1:$P(ERR,U,3))
S I=$$TYPE(+ERR,.TYPE)
;---
S EXIT=0 D
. D EN^DDIOL($J(+ERR,4),,"!"),EN^DDIOL($E($P(ERR,U,2),1,IOM-7),,"?6")
. I $Y'<ONCMNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
. ;---
. I $G(ONC8INFO)'="",$D(@ONC8INFO)>1 S I="" D
..;Error text formatting
..I ONC8INFO="ONCSAPI(""MSG"",1,1)" D
...N LINECNT,LINE,LINE1,LINE2,SUB
...S LINECNT=0
...S SUB=0 F S SUB=$O(ONCSAPI("MSG","1",1,SUB)) Q:SUB'>0 S LINE=ONCSAPI("MSG","1",1,SUB) D
....S LINECNT=LINECNT+1
....S LINE1=$P(LINE,".",1)
....S LINE2=$P(LINE,".",2)
....S ONCSAPI("NEWMSG","1",1,LINECNT)=LINE1_"."
....I LINE2'="" S LINECNT=LINECNT+1 S ONCSAPI("NEWMSG","1",1,LINECNT)=LINE2_"."
...M ONCSAPI("MSG")=ONCSAPI("NEWMSG")
. . F S I=$O(@ONC8INFO@(I)) Q:I="" D Q:EXIT
. . . D EN^DDIOL($E(@ONC8INFO@(I),1,IOM-7),,"!?6")
. . . S:$Y'<ONCMNL EXIT=$$PAGE^ONCSAPIU()
. Q:EXIT
. ;---
. D EN^DDIOL(TYPE,,"!?6"),EN^DDIOL(LOC,,"?22"):LOC'?.1"^"
. I $Y'<ONCMNL S EXIT=$$PAGE^ONCSAPIU() Q:EXIT
;---
D EN^DDIOL(" ")
Q EXIT
;
;***** STORES THE MESSAGE INTO THE ERROR STACK
;
; ERROR Error descriptor (see ^ONCSAPI)
;
; [ONC8INFO] Closed root of the variable that contains
; additional information related to the error
;
STORE(ERROR,ONC8INFO) ;
Q:'$D(ONCSAPI("MSG"))!($G(ERROR)'<0)
N IEN
S IEN=$O(ONCSAPI("MSG"," "),-1)+1
S ONCSAPI("MSG",IEN,0)=ERROR
M:$G(ONC8INFO)'="" ONCSAPI("MSG",IEN,1)=@ONC8INFO
S ONCSAPI("MSG","E",+ERROR,IEN)=""
Q
;
;***** RETURNS TYPE OF THE MESSAGE
;
; ERRCODE Error code
;
; [.DESCR] Reference to a local variable where the type
; description is returned to
;
TYPE(ERRCODE,DESCR) ;
I ERRCODE'<0 S DESCR="" Q 0
N I,TYPE S I=-ERRCODE
S I=$P($T(MSGLIST+I),";;",2),TYPE=+$TR($P(I,U,2)," ")
S:TYPE'>0 TYPE=6
S DESCR=$P("Debug^Information^Data Quality^Warning^Database Error^Error",U,TYPE)
Q TYPE
;
;***** 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 input parameters
;; -2 ^ 6 ^ Errors returned by the Oncology web-service
;; -3 ^ 4 ^ XML parsing warning
;; -4 ^ 6 ^ XML parsing error
;; -5 ^ 6 ^ Error(s) during parsing of the result XML
;; -6 ^ 6 ^ Parameter '|1|' has an invalid value: '|2|'
;; -7 ^ 2 ^ Oncology web-service temporary moved to '|1|'
;; -8 ^ 2 ^ Oncology web-service permanently moved to '|1|'
;; -9 ^ 6 ^ FileMan DBS call error(s)|2|
;; -10 ^ 6 ^ HTTP client error(s)
;; -11 ^ 6 ^ Invalid URL of the Oncology web-service
;; -12 ^ 6 ^ Too many redirections (|1|)
;; -13 ^ 6 ^ Cannot get the CS version number
;; -14 ^ 6 ^ Cannot get the schema number and name
;; -15 ^ 6 ^ Cannot lock the |1|
;; -16 ^ 6 ^ Invalid combination of input parameters: |1|
;; -17 ^ 6 ^ Cannot update the Oncology web-service URL in file #160.1
;; -18 ^ 6 ^ Missing redirection URL
;; -19 ^ 2 ^ Unfortunately, the extended help is unavailable now.
;; -20 ^ 2 ^ Unfortunately, input value cannot be validated.
;; -21 ^ 2 ^ Unfortunately, the code description is unavailable now.
;; -22 ^ 6 ^ Cannot get the URL of the Oncology web-service
;; -23 ^ 6 ^ Cannot get the EDITS metafile version number
;
CLEANUP ;Cleanup
K DIERR,ONCSAPI
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSAPIE 8743 printed Dec 13, 2024@02:27:46 Page 2
ONCSAPIE ;Hines OIFO/SG - COLLABORATIVE STAGING (ERRORS) ; 10/27/06 8:59am
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;;
+3 ;
+4 QUIT
+5 ;
+6 ;***** INITIALIZES THE ERROR STACK
+7 ;
+8 ; [ENABLE] Enable error stack (0/1)
+9 ;
CLEAR(ENABLE) ;
+1 if '$DATA(ENABLE)
SET ENABLE=$DATA(ONCSAPI("MSG"))#10
+2 KILL ONCSAPI("MSG")
if ENABLE
SET ONCSAPI("MSG")=""
+3 DO CLEAN^DILF
+4 QUIT
+5 ;
+6 ;***** CHECKS THE ERRORS AFTER A FILEMAN DBS CALL
+7 ;
+8 ; ONC8MSG Closed reference of the error messages array
+9 ; (from DBS calls)
+10 ; [ERRCODE] Error code to assign
+11 ; [FILE] File number used in the DBS call
+12 ; [IENS] IENS used in the DBS call
+13 ;
+14 ; The $$DBS^ONCSAPIE function checks the DIERR and @ONC8MSG
+15 ; variables for errors after a FileMan DBS call.
+16 ;
+17 ; Return Values:
+18 ;
+19 ; If there are no errors found, it returns an empty string.
+20 ; In case of errors, the result depends on value of the ERRCODE
+21 ; parameter:
+22 ;
+23 ; If ERRCODE is omitted or equals 0, the function returns a string
+24 ; containing the list of error codes separated by comma.
+25 ;
+26 ; If ERRCODE is not zero, the $$ERROR^ONCSAPIE function is called
+27 ; and its return value is returned.
+28 ;
+29 ; NOTE: This entry point can also be called as a procedure:
+30 ; D DBS^ONCSAPIE(...) if you do not need its return value.
+31 ;
DBS(ONC8MSG,ERRCODE,FILE,IENS) ;
+1 IF '$GET(DIERR)
if $QUIT
QUIT ""
QUIT
+2 NEW ERRLST,ERRNODE,I,ONCMSGTEXT
+3 SET ERRNODE=$SELECT($GET(ONC8MSG)'="":$NAME(@ONC8MSG@("DIERR")),1:$NAME(^TMP("DIERR",$JOB)))
+4 IF $DATA(@ERRNODE)<10
if $QUIT
QUIT ""
QUIT
+5 ;--- Return a list of errors
+6 IF '$GET(ERRCODE)
Begin DoDot:1
+7 SET ERRLST=""
SET I=0
+8 FOR
SET I=$ORDER(@ERRNODE@("E",I))
if 'I
QUIT
SET ERRLST=ERRLST_","_I
+9 DO CLEAN^DILF
End DoDot:1
if $QUIT
QUIT $PIECE(ERRLST,",",2,99)
QUIT
+10 ;--- Record the error message
+11 DO MSG^DIALOG("AE",.ONCMSGTEXT,,,$GET(ONC8MSG))
DO CLEAN^DILF
+12 SET I=$SELECT($GET(FILE):"; File #"_FILE,1:"")
+13 if $GET(IENS)'=""
SET I=I_"; IENS: """_IENS_""""
+14 SET I=$$ERROR(ERRCODE,.ONCMSGTEXT,I)
+15 if $QUIT
QUIT I
QUIT
+16 ;
+17 ;***** GENERATES THE ERROR MESSAGE
+18 ;
+19 ; ERRCODE Error code.
+20 ; If the 'S' suffix is appended to the code, the error
+21 ; descriptor will not be stored into the error stack.
+22 ;
+23 ; [[.]ONCINFO] Optional additional information (either a string or
+24 ; a reference to a local array that contains strings
+25 ; prepared for storing in a word processing field)
+26 ;
+27 ; [ARG1-ARG5] Optional parameters as for $$MSG^ONCSAPIE
+28 ;
+29 ; Return Values:
+30 ; <0 Error code^Message Text^Label+Offset^Routine
+31 ; 0 Ok (if ERRCOCE'<0)
+32 ;
+33 ; NOTE: This entry point can also be called as a procedure:
+34 ; D ERROR^ONCSAPIE(...) if you do not need its return value.
+35 ;
ERROR(ERRCODE,ONCINFO,ARG1,ARG2,ARG3,ARG4,ARG5) ;
+1 IF ERRCODE'<0
if $QUIT
QUIT 0
QUIT
+2 NEW IEN,MSG,PLACE,SL,TMP
+3 ;--- Get the error location
+4 SET SL=$STACK(-1)-1
+5 FOR
if SL'>0
QUIT
Begin DoDot:1
+6 SET PLACE=$PIECE($STACK(SL,"PLACE")," ")
End DoDot:1
if '(PLACE["^ONCSAPIE")
QUIT
SET SL=SL-1
+7 if $GET(PLACE)'[U
SET PLACE=U
+8 ;--- Prepare the additional information
+9 IF $DATA(ONCINFO)=1
SET TMP=ONCINFO
KILL ONCINFO
SET ONCINFO(1)=TMP
+10 ;--- Prepare and store the message descriptor
+11 SET MSG=$$MSG(ERRCODE,,.ARG1,.ARG2,.ARG3,.ARG4,.ARG5)
+12 SET MSG=(+ERRCODE)_U_MSG_U_PLACE
+13 if ERRCODE'["S"
DO STORE(MSG,"ONCINFO")
+14 ;---
+15 if $QUIT
QUIT MSG
QUIT
+16 ;
+17 ;***** RETURNS THE TEXT AND TYPE OF THE MESSAGE
+18 ;
+19 ; ERRCODE Error code
+20 ;
+21 ; [.TYPE] Type of the error
+22 ;
+23 ; [ARG1-ARG5] Optional parameters that substitute the |n| "windows"
+24 ; in the text of the message (for example, the |2| will
+25 ; be substituted by the value of the ARG2).
+26 ;
+27 ; NOTE: The "^" is replaced with the "~" in the resulting message.
+28 ;
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 ;***** DISPLAYS THE ERROR STACK OR A SINGLE ERROR MESSAGE
+17 ;
+18 ; [ERROR] Descriptor of a single error to be displayed
+19 ;
PRTERRS(ERROR) ;
+1 if '$GET(ERROR)&($DATA(ONCSAPI("MSG"))<10)
QUIT
+2 NEW EXIT,IMSG,INFONODE,ONCMNL
+3 SET ONCMNL=$SELECT($GET(IOSL)>3:IOSL-3,1:20)
SET $Y=0
+4 ;--- Print table header
+5 DO EN^DDIOL("Code",,"!")
DO EN^DDIOL("Description",,"?6")
+6 DO EN^DDIOL("Additional Information",,"!?6")
+7 DO EN^DDIOL("Type",,"!?6")
DO EN^DDIOL("Location",,"?22")
+8 DO EN^DDIOL("----",,"!")
DO EN^DDIOL($$REPEAT^XLFSTR("-",IOM-7),,"?6")
+9 ;--- Print a single error message
+10 IF $GET(ERROR)
SET EXIT=$$PRT1ERR(ERROR)
QUIT
+11 ;--- Print the error stack (most recent messages first)
+12 SET IMSG=" "
SET EXIT=0
+13 FOR
SET IMSG=$ORDER(ONCSAPI("MSG",IMSG),-1)
if IMSG'>0
QUIT
Begin DoDot:1
+14 SET INFONODE=$NAME(ONCSAPI("MSG",IMSG,1))
+15 SET EXIT=$$PRT1ERR(ONCSAPI("MSG",IMSG,0),INFONODE)
End DoDot:1
if EXIT
QUIT
+16 QUIT
+17 ;
PRT1ERR(ERR,ONC8INFO) ;
+1 NEW EXIT,I,LOC,TYPE
+2 SET LOC=$SELECT($PIECE(ERR,U,4)'="":$PIECE(ERR,U,3,4),1:$PIECE(ERR,U,3))
+3 SET I=$$TYPE(+ERR,.TYPE)
+4 ;---
+5 SET EXIT=0
Begin DoDot:1
+6 DO EN^DDIOL($JUSTIFY(+ERR,4),,"!")
DO EN^DDIOL($EXTRACT($PIECE(ERR,U,2),1,IOM-7),,"?6")
+7 IF $Y'<ONCMNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
+8 ;---
+9 IF $GET(ONC8INFO)'=""
IF $DATA(@ONC8INFO)>1
SET I=""
Begin DoDot:2
+10 ;Error text formatting
+11 IF ONC8INFO="ONCSAPI(""MSG"",1,1)"
Begin DoDot:3
+12 NEW LINECNT,LINE,LINE1,LINE2,SUB
+13 SET LINECNT=0
+14 SET SUB=0
FOR
SET SUB=$ORDER(ONCSAPI("MSG","1",1,SUB))
if SUB'>0
QUIT
SET LINE=ONCSAPI("MSG","1",1,SUB)
Begin DoDot:4
+15 SET LINECNT=LINECNT+1
+16 SET LINE1=$PIECE(LINE,".",1)
+17 SET LINE2=$PIECE(LINE,".",2)
+18 SET ONCSAPI("NEWMSG","1",1,LINECNT)=LINE1_"."
+19 IF LINE2'=""
SET LINECNT=LINECNT+1
SET ONCSAPI("NEWMSG","1",1,LINECNT)=LINE2_"."
End DoDot:4
+20 MERGE ONCSAPI("MSG")=ONCSAPI("NEWMSG")
End DoDot:3
+21 FOR
SET I=$ORDER(@ONC8INFO@(I))
if I=""
QUIT
Begin DoDot:3
+22 DO EN^DDIOL($EXTRACT(@ONC8INFO@(I),1,IOM-7),,"!?6")
+23 if $Y'<ONCMNL
SET EXIT=$$PAGE^ONCSAPIU()
End DoDot:3
if EXIT
QUIT
End DoDot:2
+24 if EXIT
QUIT
+25 ;---
+26 DO EN^DDIOL(TYPE,,"!?6")
if LOC'?.1"^"
DO EN^DDIOL(LOC,,"?22")
+27 IF $Y'<ONCMNL
SET EXIT=$$PAGE^ONCSAPIU()
if EXIT
QUIT
End DoDot:1
+28 ;---
+29 DO EN^DDIOL(" ")
+30 QUIT EXIT
+31 ;
+32 ;***** STORES THE MESSAGE INTO THE ERROR STACK
+33 ;
+34 ; ERROR Error descriptor (see ^ONCSAPI)
+35 ;
+36 ; [ONC8INFO] Closed root of the variable that contains
+37 ; additional information related to the error
+38 ;
STORE(ERROR,ONC8INFO) ;
+1 if '$DATA(ONCSAPI("MSG"))!($GET(ERROR)'<0)
QUIT
+2 NEW IEN
+3 SET IEN=$ORDER(ONCSAPI("MSG"," "),-1)+1
+4 SET ONCSAPI("MSG",IEN,0)=ERROR
+5 if $GET(ONC8INFO)'=""
MERGE ONCSAPI("MSG",IEN,1)=@ONC8INFO
+6 SET ONCSAPI("MSG","E",+ERROR,IEN)=""
+7 QUIT
+8 ;
+9 ;***** RETURNS TYPE OF THE MESSAGE
+10 ;
+11 ; ERRCODE Error code
+12 ;
+13 ; [.DESCR] Reference to a local variable where the type
+14 ; description is returned to
+15 ;
TYPE(ERRCODE,DESCR) ;
+1 IF ERRCODE'<0
SET DESCR=""
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 if TYPE'>0
SET TYPE=6
+5 SET DESCR=$PIECE("Debug^Information^Data Quality^Warning^Database Error^Error",U,TYPE)
+6 QUIT TYPE
+7 ;
+8 ;***** LIST OF THE MESSAGES (THERE SHOULD BE NOTHING AFTER THE LIST!)
+9 ;
+10 ; The error codes are provided in the table only for clarity.
+11 ; Text of the messages are extracted using the $TEXT function and
+12 ; absolute values of the ERRCODE parameter.
+13 ;
+14 ; Message Type:
+15 ; 1 Debug 4 Warning
+16 ; 2 Information 5 Database Error
+17 ; 3 Data Quality 6 Error
+18 ;
MSGLIST ; Code Type Message Text
+1 ;; -1 ^ 6 ^ Missing input parameters
+2 ;; -2 ^ 6 ^ Errors returned by the Oncology web-service
+3 ;; -3 ^ 4 ^ XML parsing warning
+4 ;; -4 ^ 6 ^ XML parsing error
+5 ;; -5 ^ 6 ^ Error(s) during parsing of the result XML
+6 ;; -6 ^ 6 ^ Parameter '|1|' has an invalid value: '|2|'
+7 ;; -7 ^ 2 ^ Oncology web-service temporary moved to '|1|'
+8 ;; -8 ^ 2 ^ Oncology web-service permanently moved to '|1|'
+9 ;; -9 ^ 6 ^ FileMan DBS call error(s)|2|
+10 ;; -10 ^ 6 ^ HTTP client error(s)
+11 ;; -11 ^ 6 ^ Invalid URL of the Oncology web-service
+12 ;; -12 ^ 6 ^ Too many redirections (|1|)
+13 ;; -13 ^ 6 ^ Cannot get the CS version number
+14 ;; -14 ^ 6 ^ Cannot get the schema number and name
+15 ;; -15 ^ 6 ^ Cannot lock the |1|
+16 ;; -16 ^ 6 ^ Invalid combination of input parameters: |1|
+17 ;; -17 ^ 6 ^ Cannot update the Oncology web-service URL in file #160.1
+18 ;; -18 ^ 6 ^ Missing redirection URL
+19 ;; -19 ^ 2 ^ Unfortunately, the extended help is unavailable now.
+20 ;; -20 ^ 2 ^ Unfortunately, input value cannot be validated.
+21 ;; -21 ^ 2 ^ Unfortunately, the code description is unavailable now.
+22 ;; -22 ^ 6 ^ Cannot get the URL of the Oncology web-service
+23 ;; -23 ^ 6 ^ Cannot get the EDITS metafile version number
+24 ;
CLEANUP ;Cleanup
+1 KILL DIERR,ONCSAPI