summaryrefslogtreecommitdiff
path: root/src/pkg/exp/exception/exception.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/exp/exception/exception.go')
-rw-r--r--src/pkg/exp/exception/exception.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/pkg/exp/exception/exception.go b/src/pkg/exp/exception/exception.go
index 45e0be3f1..e34d0f0d7 100644
--- a/src/pkg/exp/exception/exception.go
+++ b/src/pkg/exp/exception/exception.go
@@ -11,8 +11,8 @@
package exception
import (
- "fmt";
- "runtime";
+ "fmt"
+ "runtime"
)
// A Handler function handles an arbitrary exception value x.
@@ -20,7 +20,7 @@ type Handler func(x interface{})
// An Exception carries an exception value.
type Exception struct {
- Value interface{}; // Value may be the nil exception
+ Value interface{} // Value may be the nil exception
}
// Try invokes a function f with a Handler to throw exceptions.
@@ -51,18 +51,18 @@ type Exception struct {
// })
//
func Try(f func(throw Handler)) *Exception {
- h := make(chan *Exception);
+ h := make(chan *Exception)
// execute try block
go func() {
f(func(x interface{}) {
- h <- &Exception{x};
- runtime.Goexit();
- });
- h <- nil; // clean termination
- }();
+ h <- &Exception{x}
+ runtime.Goexit()
+ })
+ h <- nil // clean termination
+ }()
- return <-h;
+ return <-h
}
@@ -79,5 +79,5 @@ func (x *Exception) String() string {
if x != nil {
return fmt.Sprintf("exception: %v", x.Value)
}
- return "";
+ return ""
}