project BLF > class PMfgPro > method StoreSIExceptions
Description
Convert exceptions that were thrown via the exception manager to normal messages in tFcMessages.
Parameters
izExceptionDS | input | dataset-handle | |
oiReturnFromService | output | integer | The return code from the MfgPro service |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/pmfgpro.p)
if not (valid-handle(izExceptionDS) and
izExceptionDS:type = "DATASET")
then return.
assign oiReturnStatus = -98.
/* First check whether there is a record in the exception table */
assign vhTable = izExceptionDS:get-buffer-handle("temp_err_msg":U).
create query vhQuery in widget-pool "non-persistent".
vhQuery:forward-only = yes.
vhQuery:add-buffer(vhTable).
vhQuery:query-prepare("for each " + vhTable:table).
vhQuery:query-open().
vhQuery:get-first(no-lock).
if not vhQuery:Query-Off-End
then do :
assign vcProgram = <M-11 GetQADContextProperty (input 'programName':U (icPropertyName)) in PMfgPro>.
assign vcMethod = <M-12 GetQADContextProperty (input 'methodName':U (icPropertyName)) in PMfgPro>.
do while not vhQuery:Query-Off-End :
assign vcContext = vhTable::tt_msg_context
vcNbr = vhTable::tt_msg_nbr
vcDesc = vhTable::tt_msg_desc
vcData = vhTable::tt_msg_data
vcField = vhTable::tt_msg_field
vcIndex = vhTable::tt_msg_index
vcSev = vhTable::tt_msg_sev.
if vcContext = ? then vcContext = "".
if vcNbr = ? then vcNbr = "".
if vcDesc = ? then vcDesc = "".
if vcData = ? then vcData = "".
if vcField = ? then vcField = "".
if vcIndex = ? then vcIndex = "".
if vcSev = ? then vcSev = "".
assign vcMessage = <M-9 GetExceptionMessageFromSINumber
(input vcNbr (icQadNbr),
input vcDesc (icQadDesc),
input vcContext (icQadContext),
input vcData (icQadData),
input vcField (icQadField),
input vcIndex (icQadIndex),
input vcSev (icQadSev)) in PMfgPro>.
Assign vcMsgContext = #T-10'The service interface returned the following error:':70(8160)T-10# + chr(10) +
"tt_msg_sev = " + vcSev + chr(10) +
"tt_msg_nbr = " + vcNbr + chr(10) +
"tt_msg_desc = " + vcDesc + chr(10) +
"tt_msg_data = " + vcData + chr(10) +
"tt_msg_context = " + vcContext + chr(10) +
"tt_msg_field = " + vcField + chr(10) +
"tt_msg_index = " + vcIndex + chr(10) +
"program = " + vcProgram + chr (10) +
"method = " + vcMethod.
Case Trim(vcSev):
When '8':U
Then Assign viMsgSeverity = 2
vcMsgType = 'S':U.
When '7':U
Then Assign viMsgSeverity = 3
vcMsgType = 'S':U.
When '4':U
Then Assign viMsgSeverity = 2
vcMsgType = 'E':U.
When '3':U
Then Assign viMsgSeverity = 3
vcMsgType = 'E':U.
When '2':U
Then Assign viMsgSeverity = 3
vcMsgType = 'W':U.
When '1':U
Then Assign viMsgSeverity = 3
vcMsgType = 'W':U.
When '0':U
Then Assign viMsgSeverity = 3
vcMsgType = 'W':U.
Otherwise Assign viMsgSeverity = 1
vcMsgType = 'S':U.
End Case.
<M-8 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input vcMsgType (icType),
input viMsgSeverity (iiSeverity),
input '' (icRowid),
input 'BLF-435':U:U (icFcMsgNumber),
input substitute(#T-8'This message was generated by the QADAppServiceCaller.p (client part of the QAD Service Interface) when calling program (&1). method (&2).':200(9364)T-8#,vcProgram,vcMethod) (icFcExplanation),
input '' (icFcIdentification),
input vcMsgContext (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in PMfgPro>
vhQuery:get-next(no-lock).
if vcSev = "2":U
then if oiReturnFromService = 0
then oiReturnFromService = 1.
else.
else if lookup (vcSev,"0,1":U) = 0
then oiReturnFromService = -1.
end.
end.
vhQuery:query-close().
delete object vhQuery.
assign oiReturnStatus = 0.