<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error handling in a SAS web application in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328253#M62481</link>
    <description>thank you for the hint with the _debug=log.&lt;BR /&gt;That's pretty easy (I'm new to SAS...:) )</description>
    <pubDate>Sat, 28 Jan 2017 20:43:08 GMT</pubDate>
    <dc:creator>defaz</dc:creator>
    <dc:date>2017-01-28T20:43:08Z</dc:date>
    <item>
      <title>Error handling in a SAS web application</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231152#M54558</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I work on a SAS web application. Whenever an error occur, the user is faced&lt;/P&gt;
&lt;P&gt;with a "Stored process error" message and a button to toggle log display.&lt;/P&gt;
&lt;P&gt;I would like instead to display a custom web page indicating which information&lt;/P&gt;
&lt;P&gt;to provide to the support team.&lt;/P&gt;
&lt;P&gt;I tried the following code without success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro error_handling;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data foo;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Something goes wrong !!!!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if &amp;amp;syscc. %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let syscc=0;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _NULL_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file _webout;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Huho ! Something went wrong&amp;lt;/h1&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _NULL_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file _webout;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%error_handling;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 13:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231152#M54558</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2015-10-22T13:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling in a SAS web application</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231170#M54559</link>
      <description>&lt;P&gt;Found this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/16/225.html" target="_blank"&gt;http://support.sas.com/kb/16/225.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the given macro :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;   /* Add the below code at the bottom of your stored process. */
   /* If an error occurs, then your customized error message   */
   /* will be displayed in the HTML output.                    */
   /* The "Show SAS log" button will not be displayed.         */

   %macro checkcc;
    options obs=max no$syntaxcheck;

    %if (&amp;amp;syscc gt 4) %then %do;
     data _null_;
     file _webout;
     put "&amp;lt;h3&amp;gt;Sorry, your request was not processed successfully.&amp;lt;h3&amp;gt;";
     rc = stpsrvset('program error', 0);
     run;
    %end;

  %let syscc=0;

 %mend checkcc;


 %checkcc;&lt;/PRE&gt;
&lt;P&gt;It improves upon my previous program as the custom page is displayed but the "Show log button" is still there. &lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 14:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231170#M54559</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2015-10-22T14:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling in a SAS web application</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231345#M54564</link>
      <description>&lt;P&gt;I managed to suppress the error message and LOG button by resetting syscc before the data step that generates the web page.&lt;/P&gt;
&lt;P&gt;So my problem is solved.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 13:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/231345#M54564</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2015-10-23T13:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling in a SAS web application / grabbing SAS-Log in any case</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328227#M62479</link>
      <description>&lt;P&gt;I know this is an old thread, but perhaps somebody is looking for an alternative solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the start of the web page body I create a hidden div 'debug_content' for debugging content, and a dokument.ready() function:&lt;/P&gt;&lt;P&gt;(here: jquery and jquery-ui is used, but also working with pure javascript)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script type="text/javascript"&amp;gt;	
$(document).ready(function() {  
/* if SASLog exists then add it to debug menu*/
  if (document.getElementById("SASLog")) {
    $( '#menu10' ).append( "&amp;lt;li id='li0'&amp;gt;&amp;lt;a href='#dbg0' id='dbg0_link' rel='dbg0' class='dbglink nav'&amp;gt;SAS Log&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;" );
/*debug_content is a hidden div to hold debugging stuff - now add a new div for SAS log*/
    $('#debug_content').append("&amp;lt;div id='dbg0' class='debug' title='SAS Log'&amp;gt;&amp;lt;/div&amp;gt;");
    $('#dbg0').hide();                 /* hide the newly created div */
    $('#SASLogbutton').hide();         /* hide the SASLog button */
    $('#dbg0').append($('#SASLog'));   /* MOVE the SASLog to the newly created div */
    $('#SASLog').show();               /* SASLog is hidden by default - show it in the hidden div*/
    $('#dbg0_link').click(function(){  /* show dialog when the menu entry is clicked */
      var id = $(this).attr('rel');
      $('#'+id).dialog({
       maxWidth:1600,
       width: 1200,
       position: { my: 'top', at: 'top' },
       closeOnEscape: true,
       height: 500,
       maxHeigth:900
       });
      $(window).scrollTop(0);
    });
  }&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when the page is entirely built, it checks for the SASLog-Id, creates a new div in the 'debugging_content' &amp;nbsp;an moves the entire SASLog in that div. The log button is hidden and a new menu entry for the SAS-log is created.&amp;nbsp;The user just see the STP error &amp;nbsp;message.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;use this technic not only for SAS-log but also for e.g.&amp;nbsp;list of macro variables, displaying work tables and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps someone finds this useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p.s. I'm looking for a way to catch the SASlog if&amp;nbsp;NO error occurs.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2017 15:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328227#M62479</guid>
      <dc:creator>defaz</dc:creator>
      <dc:date>2017-01-28T15:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling in a SAS web application</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328252#M62480</link>
      <description>Thanks for your comment. Regarding your question, the stored process has to be called with the parameter _debug valued to 'log'. You can for instance add a hidden input field _debug on the calling web page (post) or add the parameter/value in the URL (get)</description>
      <pubDate>Sat, 28 Jan 2017 20:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328252#M62480</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-28T20:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Error handling in a SAS web application</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328253#M62481</link>
      <description>thank you for the hint with the _debug=log.&lt;BR /&gt;That's pretty easy (I'm new to SAS...:) )</description>
      <pubDate>Sat, 28 Jan 2017 20:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-handling-in-a-SAS-web-application/m-p/328253#M62481</guid>
      <dc:creator>defaz</dc:creator>
      <dc:date>2017-01-28T20:43:08Z</dc:date>
    </item>
  </channel>
</rss>

