[Home] [Help]
PACKAGE BODY: APPS.FND_ADG_EXCEPTION
Source
1 package body fnd_adg_exception as
2 /* $Header: AFDGEXEB.pls 120.4 2010/09/01 20:16:44 rsanders noship $ */
3
4 /* Error Handling */
5
6 type error_table is table of varchar2(255) index by pls_integer;
7
8 G_ERR error_table;
9
10 C_ERR_NULL constant number := 0;
11 C_ERR_UNKNOWN constant number := -1;
12 C_ERR_INVALID_MSG_NO constant number := -2;
13
14 /*==========================================================================*/
15
16 procedure init_error_table
17 as
18 begin
19
20 /* Internal Errors */
21
22 G_ERR(C_ERR_NULL) := 'Error number is null!';
23 G_ERR(C_ERR_UNKNOWN) := 'Unknown error message number';
24 G_ERR(C_ERR_INVALID_MSG_NO)
25 := 'Error message number must > 0';
26
27 /* Utility Errors */
28
29 G_ERR(C_UTLERR_INVALID_DB_RELEASE) :=
30 'DB Release does not support ADG';
31 G_ERR(C_UTLERR_REGISTER_LINK_IS_NULL) :=
32 'Register connection - owner/name cannot be null';
33 G_ERR(C_UTLERR_OWNER_NOT_PUBLIC) :=
34 'Register connection - owner must be public';
35 G_ERR(C_UTLERR_REG_LINK_NOT_FOUND) :=
36 'Register connection - link not found';
37 G_ERR(C_UTLERR_STANDBY_OUT_OF_RANGE) :=
38 'Standby number out of range - max 5 systems supported';
39 G_ERR(C_UTLERR_LINK_HOST_MISMATCH) :=
40 'Database link exists but connect string does not match';
41 G_ERR(C_UTLERR_STDBY_P_LINKS_MATCH) :=
42 'Standby->Primary and Primary->standby links are the same';
43 G_ERR(C_UTLERR_RPC_SYSTEM_ON) :=
44 'RPC system needs to be disabled for this operation';
45 G_ERR(C_UTLERR_RPC_SYSTEM_OFF) :=
46 'RPC system needs to be enabled for this operation';
47 G_ERR(C_UTLERR_RPC_ADG_ON) :=
48 'ADG support needs to be disabled for this operation';
49 G_ERR(C_UTLERR_RPC_ADG_OFF) :=
50 'ADG support needs to be enabled for this operation';
51 G_ERR(C_UTLERR_INCONSISTENT_ADGSTATE) :=
52 'ADG state inconsistent with rpc system';
53 G_ERR(C_UTLERR_DIRECTIVE_MISMATCH) :=
54 'RPC state mismatch with compile directive';
55 G_ERR(C_UTLERR_INVALID_CONNECT_TYPE) :=
56 'Invalid ADG connection type';
57 G_ERR(C_UTLERR_STANDBY_NULL) :=
58 'Standby number cannot be null for selected connection type';
59 G_ERR(C_UTLERR_RPC_SYSTEM_NOT_PREPED) :=
60 'RPC must be prepared before requested action can be processed';
61 G_ERR(C_UTLERR_LINKCHK_NULL) :=
62 'Validate connection - link is null';
63 G_ERR(C_UTLERR_LINKCHK_TNS) :=
64 'Validate connection - cannot connect via link';
65 G_ERR(C_UTLERR_LINKCHK_LOOPBACK) :=
66 'Validate connection - link cannot be a loopback';
67 G_ERR(C_UTLERR_LINKCHK_BAD_DBID) :=
68 'Validate connection - remote DBID/name mismatch';
69 G_ERR(C_UTLERR_LINKCHK_BAD_DB_ROLE) :=
70 'Validate connection - remote database must be rw primary';
71 G_ERR(C_UTLERR_LINKCHK_RPC_IS_CLONE) :=
72 'Validate connection - DBIDs match but remote database is not the same as this database';
73 G_ERR(C_UTLERR_LINKCHK_BAD_STANDBY) :=
74 'Validate connection - remote database must be ro standby';
75 G_ERR(C_UTLERR_RPC_SYSTEM_LINK_BAD) :=
76 'RPC primary link must be valid before RPC can be enabled';
77 G_ERR(C_UTLERR_LINKCHK_BAD_SERVICE) :=
78 'RPC simulated standby service name mismatch';
79 G_ERR(C_UTLERR_BAD_DIR_OBJECT) :=
80 'Simulated standby directory object does not exist';
81 G_ERR(C_UTLERR_REG_CM_NOT_DEFINED) :=
82 'Standby manager not defined for request type';
83 G_ERR(C_UTLERR_CDATA_EXISTS) :=
84 ' Duplicate connection data entry';
85 G_ERR(C_UTLERR_CONNSTR_TOO_LONG) :=
86 'Register connection - connect string too long. Max ';
87
88 /* Manager Errors */
89
90 G_ERR(C_MGRERR_NOT_STANDBY) :=
91 'Validate must be run from standby';
92 G_ERR(C_MGRERR_REMOTE_NOT_PRIMARY) :=
93 'Validate: remote is not primary';
94 G_ERR(C_MGRERR_REMOTE_DOESNT_MATCH) :=
95 'Validate: remote db doesn''t match standby';
96 G_ERR(C_MGRERR_REMOTE_RESOLVE) :=
97 'Validate: cannot execute remote operation';
98 G_ERR(C_MGRERR_UNKNOWN_REMOTE_ERROR) :=
99 'Validate: unknown remote error';
100 G_ERR(C_MGRERR_FAILED_PREV_SES_CHK) :=
101 'Validate: Previous session check failed';
102 G_ERR(C_MGRERR_REMOTE_IS_LOOPBACK) :=
103 'Validate: remote session is same as standby';
104 G_ERR(C_MGRERR_RPC_EXEC_ERROR) :=
105 'RPC-EXEC';
106
107 /* Object Errors */
108
109 G_ERR(C_OBJERR_GEN_MISSING_METHOD) :=
110 'Generate : Missing method';
111 G_ERR(C_OBJERR_GEN_OVERLOADED) :=
112 'Generate : Method overloaded';
113 G_ERR(C_OBJERR_GEN_INCOMPAT) :=
114 'Generate : One or more method incompatibilities';
115 G_ERR(C_OBJERR_UNSUPPORTD_DATA_TY) :=
116 'Generate : Only date,varchar2,number and boolean supported';
117 G_ERR(C_OBJERR_UNSUPPORTD_IO_MODE) :=
118 'Generate : Invalid in/out mode';
119 G_ERR(C_OBJERR_COMPILE_ERROR) :=
120 'Compile Error: ';
121 G_ERR(C_OBJERR_COMPILE_NOT_DEFINED) :=
122 'Compile: Package not defined - ';
123 G_ERR(C_OBJERR_COMPILE_NO_CODE) :=
124 'Compile: Code is empty - ';
125 G_ERR(C_OBJERR_USAGE_NOT_VALID) :=
126 'Object Validate: Package/body not valid - recompile required';
127 G_ERR(C_OBJERR_USAGE_RPC_NOT_VALID) :=
128 'Object Validate: RPC Package/body not valid - recompile required';
129 G_ERR(C_OBJERR_USAGE_NO_DEP) :=
130 'Object Validate: Package body has no RPC dependents - either a recompile is required or RPC usage patch is missing';
131 G_ERR(C_OBJERR_USAGE_LIST_IS_EMPTY) :=
132 'Object Validate: No RPC packages defined - RPC system is invalid';
133
134 /* Support Errors */
135
136 G_ERR(C_SUPERR_PROGRAM_ACCESS_CODE) :=
137 'Illegal access - this method cannot be called directly. Use fnd_adg_utility.manage_concurrent_program';
138
139 G_ERR(C_SUPERR_INVALID_CONC_PROGRAM) :=
140 'Concurrent Application/Program not defined';
141
142 G_ERR(C_SUPERR_VALIDATE_PRIMARY) := 'DB Link does not resolve to primary';
143
144 end;
145
146 /*==========================================================================*/
147
148 function get_error_message(p_err number,p_errmsg varchar2) return varchar2
149 as
150 l_err_idx number;
151 l_err_no_str varchar2(255);
152 begin
153
154 if ( p_err is null )
155 then
156 l_err_idx := C_ERR_NULL;
157 else
158 if ( p_err <= 0 )
159 then
160 l_err_idx := C_ERR_INVALID_MSG_NO;
161 else
162 if ( G_ERR.exists(p_err) )
163 then
164 l_err_idx := p_err;
165 else
166 l_err_idx := C_ERR_UNKNOWN;
167 end if;
168 end if;
169 end if;
170
171 l_err_no_str := to_char(l_err_idx);
172
173 if ( p_err is not null )
174 then
175 if ( l_err_idx <> p_err )
176 then
177 l_err_no_str := l_err_no_str || '[' || p_err || ']';
178 end if;
179 end if;
180
181 if ( p_errmsg is null )
182 then
183 return substr('ADG-ERR '||l_err_no_str||': '||G_ERR(l_err_idx),1,2048);
184 else
185 return substr('ADG-ERR '||l_err_no_str||': '||G_ERR(l_err_idx)
186 ||' ['||p_errmsg||']',1,2048);
187 end if;
188
189 end;
190
191 /*==========================================================================*/
192
193 function get_error_msg(p_err number) return varchar2
194 as
195 begin
196
197 return get_error_message(p_err,null);
198
199 end;
200
201 /*==========================================================================*/
202
203 procedure raise_error(p_err number, p_errmsg varchar2 default null)
204 as
205 begin
206 raise_application_error(-20001,get_error_message(p_err,p_errmsg));
207 end;
208
209 /*==========================================================================*/
210
211 begin
212 init_error_table;
213 end fnd_adg_exception;