<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Seneca5 Software Blog &#187; Error Handling</title>
	<atom:link href="http://www.seneca5.com/blog/tag/error-handling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.seneca5.com/blog</link>
	<description>Expert LabVIEW™ Development</description>
	<lastBuildDate>Mon, 06 Sep 2010 15:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Errors, Errors, Everywhere</title>
		<link>http://www.seneca5.com/blog/2009/08/errors-errors-everywhere/</link>
		<comments>http://www.seneca5.com/blog/2009/08/errors-errors-everywhere/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 06:28:26 +0000</pubDate>
		<dc:creator>Craig Bedward</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[LabVIEW]]></category>
		<category><![CDATA[Error Handling]]></category>

		<guid isPermaLink="false">http://blog.seneca5.com/?p=13</guid>
		<description><![CDATA[Error handling. You know you have to do&#8230;well, you should do it&#8230;well, maybe you will get the code working and then come back later and add proper error handling. Let&#8217;s be honest, you will never go back and do it. If you can&#8217;t take time to do it right the first time, how do you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ShinyYellow_error.png"><img class="alignright size-full wp-image-167" title="ShinyYellow_error" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ShinyYellow_error.png" alt="ShinyYellow_error" width="128" height="128" /></a> Error handling. You know you have to do&#8230;well, you should do it&#8230;well, maybe you will get the code working and then come back later and add proper error handling.</p>
<p>Let&#8217;s be honest, you will never go back and do it. If you can&#8217;t take time to do it right the first time, how do you expect to find time to do it over again?</p>
<p>Error handling is not the most fun aspect of programming, but doing it right can separate a buggy program from good solid code.</p>
<p><span id="more-13"></span></p>
<h3>Seneca5 Error Logging Class</h3>
<p>We have created a simple class that helps handle errors. It takes care of the most common needs for dealing with errors: Reporting, Cleaning, Displaying, and Logging. This is not an error handler, in the sense that it takes no particular action based on an error; you can still do that with code specific to the event. The purpose is to provide a way to make sure all errors are caught and recorded.</p>
<h3>Features</h3>
<ul>
<li>Central collection of errors that occur throughout your program</li>
<li>Timestamps errors</li>
<li>Save errors to a file</li>
<li>Optionally supresses duplicate consecutive errors</li>
</ul>
<h3>Class Methods</h3>
<p><img class="alignnone size-full wp-image-140" title="ErrorLog_Create" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_Create1.png" alt="ErrorLog_Create" width="364" height="172" /></p>
<p><img class="alignnone size-full wp-image-141" title="ErrorLog_Destroy" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_Destroy.png" alt="ErrorLog_Destroy" width="266" height="149" /></p>
<p><img class="alignnone size-full wp-image-142" title="ErrorLog_LogError" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_LogError.png" alt="ErrorLog_LogError" width="326" height="113" /></p>
<p><img class="alignnone size-full wp-image-143" title="ErrorLog_GetErrors" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_GetErrors.png" alt="ErrorLog_GetErrors" width="333" height="157" /></p>
<p><img class="alignnone size-full wp-image-144" title="ErrorLog_ShowErrorDialog" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ShowErrorDialog.png" alt="ErrorLog_ShowErrorDialog" width="248" height="102" /></p>
<p><img class="alignnone size-full wp-image-145" title="ErrorLog_ClearErrors" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ClearErrors.png" alt="ErrorLog_ClearErrors" width="267" height="115" /></p>
<h3>Example Program</h3>
<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ExampleFrontPanel.png"><img class="alignnone size-full wp-image-156" title="ErrorLog_ExampleFrontPanel" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ExampleFrontPanel.png" alt="ErrorLog_ExampleFrontPanel" width="572" height="368" /></a></p>
<p><a href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ExampleDiagram.png"><img class="alignnone size-full wp-image-158" title="ErrorLog_ExampleDiagram" src="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog_ExampleDiagram.png" alt="ErrorLog_ExampleDiagram" width="591" height="185" /></a></p>
<p>This example shows the basic usage of the ErrorLog class. Once the object is constructed, you can use the same object from multiple loops in your program. You can also use the object reference to pass to sub-VI&#8217;s that you call. You can even pass a reference to a VI executing in parallel (although that is a little trickier).</p>
<p>Every place that can generate errors uses the Log Error VI to process the error. Each call to LogError includes a string to indicate the context of the code that generated the error. That ensures that all of the errors are collected, including a timestep and context, which can be very helpful later for finding the source of a problem.</p>
<p>You can use the Get Errors function in your main GUI loop to watch for errors to occur and light up an indicator. When the user sees that an error has occurred, he can hit the Show Errors button to bring up a dialog box that shows the history of errors.</p>
<h3>Download</h3>
<p>The example program is written in LabVIEW 8.5 with full access to the source. There is a simple example, as well as a more complex example that shows how to use multiple loops and customized a popup window.<br />
Download: <a href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/Example-S5Tools-ErrorLog-Class.zip">[Example] S5Tools ErrorLog Class.zip</a></p>
<p>This class has been saved in LabVIEW 8.5. Although password protected, the diagrams are present, so upgrading should be no problem. Download ErrorLog.llb and install into &lt;LabVIEW&gt;\user.lib\S5Tools<br />
Download: <a style="text-decoration: none;" href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/ErrorLog.llb">ErrorLog.llb</a></p>
<p>The class is built with the Endevo GOOP Toolkit, version 2. The GOOP2 run-time is required to use the class. Download _goop2.llb and install into &lt;LabVIEW&gt;\vi.lib\addons<br />
Download: <a href="http://www.seneca5.com/blog/wp-content/uploads/2009/08/goop2.llb">_goop2.llb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.seneca5.com/blog/2009/08/errors-errors-everywhere/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
