Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jollheef committed May 12, 2019
1 parent 9ac5d98 commit 660c8a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions appvm.go
Expand Up @@ -8,6 +8,7 @@
package main

import (
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -190,6 +191,13 @@ func generateVM(name string, verbose bool) (realpath, reginfo, qcow2 string, err
status := <-command.Start()
if status.Error != nil || status.Exit != 0 {
log.Println(status.Error, status.Stdout, status.Stderr)
if status.Error != nil {
err = status.Error
} else {
s := fmt.Sprintf("ret code: %d, out: %v, err: %v",
status.Exit, status.Stdout, status.Stderr)
err = errors.New(s)
}
return
}

Expand Down

0 comments on commit 660c8a5

Please sign in to comment.