aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-13 12:43:47 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-13 12:43:47 +0200
commitfb0f5530f100e8ae3b8561fe5dcfd19edc181b15 (patch)
tree1e7a3d63d4d02e4dab56a0ee58aae5317401e706 /commands
parentf569e6aacc0690e7b1bebf33a10a8e0d154937df (diff)
downloadgit-bug-fb0f5530f100e8ae3b8561fe5dcfd19edc181b15.tar.gz
catch a lot of error not being checked
Diffstat (limited to 'commands')
-rw-r--r--commands/root.go4
-rw-r--r--commands/webui.go11
2 files changed, 12 insertions, 3 deletions
diff --git a/commands/root.go b/commands/root.go
index 83722781..9aece1d4 100644
--- a/commands/root.go
+++ b/commands/root.go
@@ -28,7 +28,9 @@ It use the same internal storage so it doesn't pollute your project. As you woul
// even if we just display the help. This is to make sure that we check
// the repository and give the user early feedback.
Run: func(cmd *cobra.Command, args []string) {
- cmd.Help()
+ if err := cmd.Help(); err != nil {
+ os.Exit(1)
+ }
},
// Load the repo before any command execution
diff --git a/commands/webui.go b/commands/webui.go
index 66cc2a9d..d64bca53 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -87,7 +87,10 @@ func runWebUI(cmd *cobra.Command, args []string) error {
fmt.Printf("Graphql API: http://%s/graphql\n", addr)
fmt.Printf("Graphql Playground: http://%s/playground\n", addr)
- open.Run(webUiAddr)
+ err = open.Run(webUiAddr)
+ if err != nil {
+ fmt.Println(err)
+ }
err = srv.ListenAndServe()
if err != nil && err != http.ErrServerClosed {
@@ -188,7 +191,11 @@ func (gufh *gitUploadFileHandler) ServeHTTP(rw http.ResponseWriter, r *http.Requ
}
rw.Header().Set("Content-Type", "application/json")
- rw.Write(js)
+ _, err = rw.Write(js)
+ if err != nil {
+ http.Error(rw, err.Error(), http.StatusInternalServerError)
+ return
+ }
}
var webUICmd = &cobra.Command{