develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33750 - trunk/languages/WMLScript/src

From:
fperrad
Date:
December 10, 2008 00:28
Subject:
[svn:parrot] r33750 - trunk/languages/WMLScript/src
Message ID:
20081210082826.92E08CB9AF@x12.develooper.com
Author: fperrad
Date: Wed Dec 10 00:28:25 2008
New Revision: 33750

Modified:
   trunk/languages/WMLScript/src/wmlsstdlibs.pir

Log:
[WMLScript]
- refactor exception handling (with rethrow)

Modified: trunk/languages/WMLScript/src/wmlsstdlibs.pir
==============================================================================
--- trunk/languages/WMLScript/src/wmlsstdlibs.pir	(original)
+++ trunk/languages/WMLScript/src/wmlsstdlibs.pir	Wed Dec 10 00:28:25 2008
@@ -120,11 +120,9 @@
     die "unable to load compilation unit"
   _handler:
     .local pmc e
-    .local string msg
     .get_results (e)
-    msg = e
-    say msg
-    $S0 = "verification failed (can't translate '"
+    $S0 = e
+    $S0 .= "\nverification failed (can't translate '"
     $S0 .= url
     $S0 .= "')"
     e = $S0
@@ -141,13 +139,13 @@
     pop_eh
     .return (content)
   _handler:
-    $S0 = err
-    print "Can't slurp '"
-    print filename
-    print "' ("
-    print $S0
-    print ")\n"
-  L1:
+    $S0 = "Can't slurp '"
+    $S0 .= filename
+    $S0 .= "' ("
+    $S1 = err
+    $S0 .= $S1
+    $S0 .= ")\n"
+    printerr $S0
     .return ('')
 .end
 
@@ -165,12 +163,16 @@
     fh.'close'()
     .return (output)
   _handler:
-    $S0 = err
-    print "Can't open '"
-    print output
-    print "' ("
-    print $S0
-    print ")\n"
+    .local pmc e
+    .get_results (e)
+    $S0 = "Can't open '"
+    $S0 .= output
+    $S0 .= "' ("
+    $S1 = err
+    $S0 .= $S1
+    $S0 .= ")\n"
+    e = $S0
+    rethrow e
 .end
 
 .sub 'save_pir'
@@ -187,12 +189,16 @@
     fh.'close'()
     .return ()
   _handler:
-    $S0 = err
-    print "Can't open '"
-    print output
-    print "' ("
-    print $S0
-    print ")\n"
+    .local pmc e
+    .get_results (e)
+    $S0 = "Can't open '"
+    $S0 .= output
+    $S0 .= "' ("
+    $S1 = err
+    $S0 .= $S1
+    $S0 .= ")\n"
+    e = $S0
+    rethrow e
 .end
 
 =back



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About