Focal Point
Error Page

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5171029842

September 27, 2007, 12:05 PM
Sayed
Error Page
Hello,

I want a generic HTML page returned when a focexec returns an error. Any idea how this can be accomplished?


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
September 27, 2007, 12:58 PM
Francis Mariani
...
END
-RUN
-IF &FOCERRNUM NE 0 GOTO FOCERROR;

...

-EXIT

-FOCERROR
-HTMLFORM BEGIN
your HTML here
-HTMLFORM END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 27, 2007, 03:38 PM
Darin Lee
I just have a fex that can check &FOCERRNUM, &RECORDS, or &LINES that I -INCLUDE at the end of most fexes.
for example:
-SET &OUTPUT='HTML';
-IF &FOCERRNUM EQ 0 THEN GOTO NOERROR;
-NOLINES
TABLE FILE CAR
PRINT CAR NOPRINT
HEADING
"There was an error generating this report."
WHERE READLIMIT EQ 1
ON TABLE SET ONLINE-FMT &OUTPUT
ON TABLE SET PAGE NOPAGE
END
-RUN
-NOERROR


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 27, 2007, 04:13 PM
Sayed
I tried the following and my error html page runs? I would expect it to exit before.

TABLE FILE CAR
PRINT *
END
-RUN
-IF &FOCERRNUM NE 0 GOTO FOCERROR;
-EXIT
-FOCERROR
-HTMLFORM BEGIN


Error Page


Were Sorry!


&FOCERRNUM The document you requested cannot be found.




-HTMLFORM END


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
September 27, 2007, 04:27 PM
susannah
Sayed, as Gerry says, WYSIWYC..you're getting exactly what you coded.
the focerrnum for this bit of code is 757
0(FOC757) WARNING. YOU REQUESTED PRINT * OR COUNT * FOR A MULTIPATH FILE
The PRINT * and COUNT * commands cause the left-most path in a file
to be referenced. If the file has more than one path, data which is
not part of the left-most path is not printed or counted.

Do your test again, with a code snipped where the &FOCERRNUM is truly 0.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
September 27, 2007, 04:33 PM
Sayed
Hi Susannah,

I'm lost now. All I'm trying to do is send my users to a default error page if my code breaks on my PROD environment. I do not want them to see any FOC ERROR messeges.


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
September 27, 2007, 04:35 PM
Sayed
For example I'd expect this code to break and then go to my error page only

TABLE FILE CAR
printt *
END


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
September 28, 2007, 03:31 AM
Tony A
Sayed,

This code will produce an error (check the source code within the HTML via context menu - right click)
TABLE FILE CAR
PRINT *
END
-RUN

This should not (unless you do not have the CAR file mas and foc in your path!!)
TABLE FILE CAR
PRINT COUNTRY
END
-RUN

The reason, as Susannah has already mentioned, is that the PRINT * against the CAR file would produce a selection against a multiple path and it has always been that FOCUS produces an internal error for this, even if it is a warning!

Your last example
TABLE FILE CAR
printt *
END
-RUN

Would produce a syntax error. This is not the only type of error you should be checking for.
Apart from the fact that, if you put code like that into your live environment, it would show a distinct lack of testing being done beforehand!!
Check for errors that could occur in live, such as file not found, EDA down, security error etc. etc.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 28, 2007, 10:28 AM
Sayed
Thanks for the clarity Tony. So I can still have &FOCERRNUM NE 0 when my focexec runs and return a report?

I was expecting &FOCERRNUM EQ 0 whenever I get a report back otherwise trap the error and send users to a default error page.


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
September 28, 2007, 11:05 AM
susannah
when you have written your report imperfectly, yes you'll get a &FOCERRNUM >0. So be sure to TEST your reports to determine their &FOCERRNUM, and whether or not it is acceptable to you, before putting them in to production, if you plan to use &FOCERRNUM as a branching determinant.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
September 28, 2007, 01:12 PM
Sayed
Thank You ALL for your suggestions. It has been a great help.


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE