Highlighted
David Taggart Respected Contributor.
Respected Contributor.
723 views

Rewrite BrowserEngine errors

Jump to solution

I'm attempting to capture a few errors generated by BDF scripts in Silk Performer 16.5, and rewrite them for reporting purposes. So far I can accurately capture errors 46 and 65, but am now trying to capture and rewrite error 7. The code that doesn't capture this appropriately is below:

 

dclevent
    handler Handler0 <EVENT_RAISE_ERROR>
  var
    nErr : number;
  begin
    if GetErrorCode(GetLastError()) = 46 then
       nErr := CreateErrorCode(FACILITY_GUILEVEL_TESTING_REPLAY, 3, SEVERITY_ERROR);
       trueLogInfo("Intercepted error BrowserEngine: 46");
       RaiseError(nErr, NULL, SEVERITY_TRANS_EXIT);
    elseif GetErrorCode(GetLastError()) = 7 then
       nErr := CreateErrorCode(FACILITY_GUILEVEL_TESTING_REPLAY, 3, SEVERITY_ERROR);
       trueLogInfo("Intercepted error BrowserEngine: 7");
       RaiseError(nErr, NULL, SEVERITY_TRANS_EXIT);
    end;
  end Handler0;
 
  handler Handler1 <EVENT_RAISE_TRANS_EXIT>
  var
    nErr : number;
  begin
    ErrorAdd(FACILITY_BROWSERENGINE, 46, SEVERITY_SUCCESS);
    ErrorAdd(FACILITY_BROWSERENGINE, 7, SEVERITY_SUCCESS);
    if GetErrorCode(GetLastError()) = 65 then
       nErr := CreateErrorCode(FACILITY_GUILEVEL_TESTING_REPLAY, 3, SEVERITY_ERROR);
        trueLogInfo("Intercepted error BrowserEngine: 65");
       RaiseError(nErr, NULL, SEVERITY_TRANS_EXIT);
    end;
  end Handler1;

 

What am I missing?

0 Likes
1 Solution

Accepted Solutions
Micro Focus Contributor
Micro Focus Contributor

RE: Rewrite BrowserEngine errors

Jump to solution
The error code 7 is a different severity - process exit. Your current handlers only catch error and transactrion exit severities so you need to add another one:

handler Handler2 <EVENT_RAISE_PROC_EXIT>
var
nErr : number;
begin
ErrorAdd(FACILITY_BROWSERENGINE, 46, SEVERITY_SUCCESS);
ErrorAdd(FACILITY_BROWSERENGINE, 7, SEVERITY_SUCCESS);
if GetErrorCode(GetLastError()) = 7 then
nErr := CreateErrorCode(FACILITY_GUILEVEL_TESTING_REPLAY, 3, SEVERITY_ERROR);
trueLogInfo("Intercepted error BrowserEngine: 7");
RaiseError(nErr, NULL, SEVERITY_TRANS_EXIT);
end;
end Handler2;
1 Reply
Micro Focus Contributor
Micro Focus Contributor

RE: Rewrite BrowserEngine errors

Jump to solution
The error code 7 is a different severity - process exit. Your current handlers only catch error and transactrion exit severities so you need to add another one:

handler Handler2 <EVENT_RAISE_PROC_EXIT>
var
nErr : number;
begin
ErrorAdd(FACILITY_BROWSERENGINE, 46, SEVERITY_SUCCESS);
ErrorAdd(FACILITY_BROWSERENGINE, 7, SEVERITY_SUCCESS);
if GetErrorCode(GetLastError()) = 7 then
nErr := CreateErrorCode(FACILITY_GUILEVEL_TESTING_REPLAY, 3, SEVERITY_ERROR);
trueLogInfo("Intercepted error BrowserEngine: 7");
RaiseError(nErr, NULL, SEVERITY_TRANS_EXIT);
end;
end Handler2;
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.