<?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>saturn return to sender &#187; exceptions</title>
	<atom:link href="http://balanceinmotion.net/blog/tag/exceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://balanceinmotion.net/blog</link>
	<description></description>
	<lastBuildDate>Tue, 10 Nov 2009 23:33:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>line numbers in php exceptions</title>
		<link>http://balanceinmotion.net/blog/2008/10/20/line-numbers-in-php-exceptions/</link>
		<comments>http://balanceinmotion.net/blog/2008/10/20/line-numbers-in-php-exceptions/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 23:17:27 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[problems+solutions]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[silly languages]]></category>

		<guid isPermaLink="false">http://balanceinmotion.net/blog/?p=370</guid>
		<description><![CDATA[Quick geeky public service announcement. PHP 5&#8217;s Exception objects have line number and file name fields which are automatically populated for you. Refer to this page for details. 
Ok, cool, but the question is: do those fields correspond to the construction site or the throw site? Based on this little experiment:

try {
	$exception = new Exception('exception [...]]]></description>
			<content:encoded><![CDATA[<p>Quick geeky public service announcement. PHP 5&#8217;s Exception objects have line number and file name fields which are automatically populated for you. Refer to <a href="http://php.net/exceptions">this page</a> for details. </p>
<p>Ok, cool, but the question is: do those fields correspond to the construction site or the throw site? Based on this little experiment:</p>
<pre class="code">
try {
	$exception = new Exception('exception constructed on '.__LINE__);
	throw $exception;
}
catch (Exception $e) {
	echo $e->getMessage().', (internal line:'.$e->getLine().')';
}
</pre>
<p>&#8230; they appear to refer to the <i>construction</i> site. In this case, the line number in the message (which is produced by the __LINE__ magic constant at the point of construction) and the return value of getLine() (made however it is the exception facility determines the line number) is the same number.</p>
<p>At first blush, this behavior seems less useful to me than if line numbers and file names were attached to the throw site. That&#8217;s where the exception actually <i>occurs</i>. It may be constructed entirely elsewhere. Hmmm. </p>
<p>Anyway, I couldn&#8217;t find an answer out there right away, at least with the terms I used to ask <a href="http://google.com">The Great Oracle</a>. So here &#8217;tis.</p>
]]></content:encoded>
			<wfw:commentRss>http://balanceinmotion.net/blog/2008/10/20/line-numbers-in-php-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
