summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-04 12:48:18 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-04 12:48:18 +0000
commit208bd5ee9e8c25ea591e5d66578d6313df3671bf (patch)
tree739a9e41c661c99f9744c475d3d5a2cf8c60a9ca
parent1fb1bf6d270934ed2d18860b4086ba41d91e55ce (diff)
downloadscala-208bd5ee9e8c25ea591e5d66578d6313df3671bf.tar.gz
scala-208bd5ee9e8c25ea591e5d66578d6313df3671bf.tar.bz2
scala-208bd5ee9e8c25ea591e5d66578d6313df3671bf.zip
- Added file ResultOrException.java
-rw-r--r--sources/scala/runtime/ResultOrException.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/sources/scala/runtime/ResultOrException.java b/sources/scala/runtime/ResultOrException.java
new file mode 100644
index 0000000000..e264acd354
--- /dev/null
+++ b/sources/scala/runtime/ResultOrException.java
@@ -0,0 +1,41 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+package scala.runtime;
+
+/** @meta class [?A] extends scala.Object;
+ */
+public class ResultOrException {
+
+ /** @meta field ?A;
+ */
+ public Object result;
+
+ public Throwable exc;
+
+ /** @meta constr(?A, java.lang.Throwable);
+ */
+ ResultOrException(Object result, Throwable exc) {
+ this.result = result;
+ this.exc = exc;
+ }
+
+
+ /** @meta method [?A] (def ?A) scala.runtime.ResultOrException[?A];
+ */
+ public static ResultOrException tryBlock(scala.Function0 block) {
+ try {
+ return new ResultOrException(block.apply(), null);
+ } catch (Throwable ex) {
+ return new ResultOrException(null, ex);
+ }
+ }
+}
+