playground: Add TryInit, which is like init, but it returns an error istead of
panicking..
Also, commandline utilities will use the error version to avoid
panics which are bad UX....
MultiPart: 4/4
Change-Id: I73460c40b86b22ce2543e8fbee858ed68d42f94e
diff --git a/go/src/v.io/x/playground/bundles/fortune/src/client/client.go b/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
index 80fb5ff..4cef015 100644
--- a/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
+++ b/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
@@ -9,6 +9,7 @@
import (
"fmt"
+ "os"
"time"
"v.io/v23"
@@ -20,7 +21,11 @@
func main() {
// Initialize Vanadium.
- ctx, shutdown := v23.Init()
+ ctx, shutdown, err := v23.TryInit()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "failed to initialize vanadium runtime: %v", err)
+ os.Exit(1)
+ }
defer shutdown()
// Create a new stub that binds to address without