source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCXERR.m@ 1259

Last change on this file since 1259 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.4 KB
RevLine 
[613]1ONCXERR ;HCIOFO/SG - HTTP AND WEB SERVICES (ERRORS) ; 6/21/04 2:35pm
2 ;;2.11;ONCOLOGY;**40**;Mar 07, 1995
3 ;
4 Q
5 ;
6 ;***** GENERATES THE ERROR MESSAGE
7 ;
8 ; ERRCODE Error code
9 ;
10 ; [[.]INFO] reserved
11 ;
12 ; [ARG1-ARG5] Optional parameters as for $$MSG^ONCXERR
13 ;
14 ; Return Values:
15 ; <0 Error code^Message Text^Label+Offset^Routine
16 ; 0 Ok (if ERRCOCE'<0)
17 ;
18ERROR(ERRCODE,INFO,ARG1,ARG2,ARG3,ARG4,ARG5) ;
19 Q:ERRCODE'<0 0
20 N PLACE,SL
21 S SL=$STACK(-1)-1
22 F Q:SL'>0 D Q:'(PLACE["^ONCXERR") S SL=SL-1
23 . S PLACE=$P($STACK(SL,"PLACE")," ")
24 S:PLACE'[U PLACE=U
25 Q ERRCODE_U_$$MSG(ERRCODE,,.ARG1,.ARG2,.ARG3,.ARG4,.ARG5)_U_PLACE
26 ;
27 ;***** RETURNS THE TEXT OF THE MESSAGE
28 ;
29 ; ERRCODE Error code
30 ;
31 ; [.TYPE] Type of the error
32 ;
33 ; [ARG1-ARG5] Optional parameters that substitute the |n| "windows"
34 ; in the text of the message (for example, the |2| will
35 ; be substituted by the value of the ARG2).
36 ;
37 ; NOTE: The "^" is replaced with the "~" in the resulting message.
38 ;
39MSG(ERRCODE,TYPE,ARG1,ARG2,ARG3,ARG4,ARG5) ;
40 S TYPE=6 Q:ERRCODE'<0 ""
41 N ARG,I1,I2,MSG
42 ;--- Get a descriptor of the message
43 S I1=-ERRCODE,MSG=$P($T(MSGLIST+I1),";;",2)
44 S I1=+$TR($P(MSG,U,2)," "),MSG=$P(MSG,U,3,999)
45 S:I1>0 TYPE=I1
46 Q:MSG?." " "Unknown error ("_ERRCODE_")"
47 ;--- Substitute parameters
48 S I1=2
49 F S I1=$F(MSG,"|",I1-1) Q:'I1 D
50 . S I2=$F(MSG,"|",I1) Q:'I2
51 . X "S ARG=$G(ARG"_+$TR($E(MSG,I1,I2-2)," ")_")"
52 . S $E(MSG,I1-1,I2-1)=ARG
53 Q $TR($$TRIM^XLFSTR(MSG),U,"~")
54 ;
55 ;***** RETURNS TYPE OF THE MESSAGE
56 ;
57 ; ERRCODE Error code
58 ;
59TYPE(ERRCODE) ;
60 Q:ERRCODE'<0 0
61 N I,TYPE S I=-ERRCODE
62 S I=$P($T(MSGLIST+I),";;",2),TYPE=+$TR($P(I,U,2)," ")
63 Q $S(TYPE>0:TYPE,1:6)
64 ;
65 ;***** LIST OF THE MESSAGES (THERE SHOULD BE NOTHING AFTER THE LIST!)
66 ;
67 ; The error codes are provided in the table only for clarity.
68 ; Text of the messages are extracted using the $TEXT function and
69 ; absolute values of the ERRCODE parameter.
70 ;
71 ; Message Type:
72 ; 1 Debug 4 Warning
73 ; 2 Information 5 Database Error
74 ; 3 Data Quality 6 Error
75 ;
76MSGLIST ; Code Type Message Text
77 ;; -1 ^ 6 ^ Missing host name: '|1|'
78 ;; -2 ^ 6 ^ Cannot resolve the host name: '|1|'
79 ;; -3 ^ 6 ^ Cannot connect to host(s): '|1|'
80 ;; -4 ^ 6 ^ Missing redirection URL
81 ;; -5 ^ 6 ^ Too many redirections
82 ;; -6 ^ 6 ^ Error during transaction (see Error Trap log)
83 ;; -7 ^ 6 ^ Timeout
Note: See TracBrowser for help on using the repository browser.