Skip to content

Commit

Permalink
Handle the possibility that a juju error doesn't have the line number
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosuppo committed Jun 23, 2017
1 parent 475d50e commit def7240
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@ func stacktrace(err error) StackTrace {
for _, line := range s {
parts := strings.Split(line, ":")

n, err := strconv.Atoi(parts[1])
if err != nil {
var n int
if len(parts) < 1 {
n = -1
} else {
var err error
n, err = strconv.Atoi(parts[1])
if err != nil {
n = -1
}
}

stack.AddEntry(n, "", parts[0], "")
Expand Down

0 comments on commit def7240

Please sign in to comment.