aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/vartan/compile.go8
-rw-r--r--cmd/vartan/parse.go7
2 files changed, 9 insertions, 6 deletions
diff --git a/cmd/vartan/compile.go b/cmd/vartan/compile.go
index 3753cd0..f29e972 100644
--- a/cmd/vartan/compile.go
+++ b/cmd/vartan/compile.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "runtime/debug"
"strings"
verr "github.com/nihei9/vartan/error"
@@ -46,8 +47,8 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) {
if v != nil {
err, ok := v.(error)
if !ok {
- retErr = fmt.Errorf("an unexpected error occurred: %v\n", v)
- fmt.Fprintln(os.Stderr, retErr)
+ retErr = fmt.Errorf("an unexpected error occurred: %v", v)
+ fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack()))
return
}
@@ -67,7 +68,8 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) {
}
}
}
- fmt.Fprintln(os.Stderr, retErr)
+
+ fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack()))
}
}()
diff --git a/cmd/vartan/parse.go b/cmd/vartan/parse.go
index d5e3d36..61456cf 100644
--- a/cmd/vartan/parse.go
+++ b/cmd/vartan/parse.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
+ "runtime/debug"
"github.com/nihei9/vartan/driver"
"github.com/nihei9/vartan/spec"
@@ -37,8 +38,8 @@ func runParse(cmd *cobra.Command, args []string) (retErr error) {
if v != nil {
err, ok := v.(error)
if !ok {
- retErr = fmt.Errorf("an unexpected error occurred: %v\n", v)
- fmt.Fprintln(os.Stderr, retErr)
+ retErr = fmt.Errorf("an unexpected error occurred: %v", v)
+ fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack()))
return
}
@@ -46,7 +47,7 @@ func runParse(cmd *cobra.Command, args []string) (retErr error) {
}
if retErr != nil {
- fmt.Fprintln(os.Stderr, retErr)
+ fmt.Fprintf(os.Stderr, "%v:\n%v", retErr, string(debug.Stack()))
}
}()