Make CLI functions return error instead of fatal out (#1379)

Before this PR, CLI functions fatal out when encountering error
instead of returning it. Such behavior makes it hard to reuse 
the functions nor writing unit tests. This PR aims to make functions 
return errors instead of error out.
This commit is contained in:
Ta-Ching Chen
2019-11-05 16:50:13 +08:00
committed by GitHub
parent b0d27ee5d2
commit 93d4b88d84
72 changed files with 894 additions and 632 deletions
+5 -2
View File
@@ -19,13 +19,13 @@ package spec
import (
"context"
"fmt"
"os"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
"github.com/fission/fission/pkg/controller/client"
"github.com/fission/fission/pkg/fission-cli/util"
"github.com/fission/fission/pkg/types"
)
@@ -68,7 +68,10 @@ func (w *packageBuildWatcher) watch(ctx context.Context) {
// pull list of packages (TODO: convert to watch)
pkgs, err := w.fclient.PackageList(metav1.NamespaceAll)
util.CheckErr(err, "Getting list of packages")
if err != nil {
fmt.Printf("Getting list of packages: %v", err)
os.Exit(1)
}
// find packages that (a) are in the app spec and (b) have an interesting
// build status (either succeeded or failed; not "none")