<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -28,8 +28,8 @@ XSLoader::load(__PACKAGE__, $VERSION);
 use namespace::clean;
 
 use Sub::Exporter -setup =&gt; {
-  exports =&gt; [qw/try/],
-  groups =&gt; { default =&gt; [qw/try/] },
+  exports =&gt; [qw/try throw/],
+  groups =&gt; { default =&gt; [qw/try throw/] },
   installer =&gt; sub {
     my ($args, $to_export) = @_;
     my $pack = $args-&gt;{into};
@@ -53,6 +53,10 @@ sub try () {
   return;
 }
 
+sub throw {
+    die ( $TryCatch::Exception = shift );
+}
+
 # Where we store all the TCs for catch blocks created at compile time
 # Not sure we really want to do this, but we will for now.
 our $TC_LIBRARY = {};
@@ -116,7 +120,7 @@ sub injected_try_code {
 
 sub injected_after_try {
   # This semicolon is for the end of the eval
-  return ';$TryCatch::Error = $@; } if ($TryCatch::Error) { ';
+  return ';$TryCatch::Error = $@ || $TryCatch::Exception; } if ($TryCatch::Error) { ';
 }
 
 sub injected_no_catch_code {
@@ -303,7 +307,7 @@ TryCatch - first class try catch semantics for Perl, without source filters.
    my ($self) = @_;
 
    try {
-     die Some::Class-&gt;new(code =&gt; 404 ) if $self-&gt;not_found;
+     throw Some::Class-&gt;new(code =&gt; 404 ) if $self-&gt;not_found;
      return &quot;return value from foo&quot;;
    }
    catch (Some::Class $e where { $_-&gt;code &gt; 100 } ) {</diff>
      <filename>lib/TryCatch.pm</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>27eddead07dd2a14b05bbcc453c85329a081f11f</id>
    </parent>
  </parents>
  <author>
    <name>pmakholm</name>
    <email>peter@makholm.net</email>
  </author>
  <url>http://github.com/pmakholm/trycatch/commit/e24964bc2f6a938004b8c5b97ffd9278c7fc5830</url>
  <id>e24964bc2f6a938004b8c5b97ffd9278c7fc5830</id>
  <committed-date>2009-05-22T01:09:27-07:00</committed-date>
  <authored-date>2009-05-22T01:09:27-07:00</authored-date>
  <message>Handle garbage collectors resetting $@ by wrapping die in a throw sub (rt #46294)</message>
  <tree>85ca7bc10625d78761a8e5d49c2792a3ca2cc05c</tree>
  <committer>
    <name>pmakholm</name>
    <email>peter@makholm.net</email>
  </committer>
</commit>
