<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Error handling and logging from within FormCode of InfoPath 2007 form</title><link>https://www.infopathdev.com:443/forums/thread/67631.aspx</link><pubDate>Wed, 22 Jun 2011 06:35:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:67631</guid><dc:creator>millie01</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/67631.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=67631</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have created an InfoPath 2007 form which makes use of some custom code I have written. I now want to implement some error handling and logging for my form. Some things about my form:&lt;/p&gt;
&lt;p&gt;It is browser enabled and will be accessed from a SharePoint site. If the user accessing the form has InfoPath installed the form will open in InfoPath. If they don&amp;#39;t have InfoPath the form will open in the browser.&lt;/p&gt;
&lt;p&gt;The form is managed and deployed through InfoPath Form services in SharePoint central admin. This is so that it makes use of universal data connections I have created to access various SharePoint lists and a web service to populate some fields on my form.&lt;/p&gt;
&lt;p&gt;I would like to be able to display a user friendly message to a user if an error is caught in any of the code behind the form. I have made use of try {} catch {} blocks. I know how to display a nice generic error message on the form to the user, i&amp;#39;m now wondering how best to go about logging the stack trace elsewhere for development support purposes. I don&amp;#39;t want to display this information to the user on the form. I am thinking of trying to write to the event log on a specific machine but am wondering if this would even be possible if the form is opened in InfoPath application on a users own machine (i.e. they probably won&amp;#39;t have access to the machine I want to write to the event log on).&lt;/p&gt;
&lt;p&gt;Has anyone done something similar previously? If so can you please let me know / give me some ideas on how I could go about logging the stack trace for dev purposes but displaying a nice user friendly error message to the user on the form.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item></channel></rss>