forked from railwayapp/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanic.go
More file actions
30 lines (26 loc) · 649 Bytes
/
Copy pathpanic.go
File metadata and controls
30 lines (26 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cmd
import (
"context"
"fmt"
"strings"
"github.com/railwayapp/cli/errors"
"github.com/railwayapp/cli/ui"
)
func (h *Handler) Panic(ctx context.Context, panicErr string, stacktrace string, cmd string, args []string) error {
cmd = cmd + " " + strings.Join(args, " ")
for _, arg := range args {
if arg == "-v" {
// Verbose mode show err
fmt.Println(panicErr, stacktrace)
}
}
success, err := h.ctrl.SendPanic(ctx, panicErr, stacktrace, cmd)
if err != nil {
return err
}
if success {
ui.StopSpinner("Successfully sent the error! We're figuring out what went wrong.")
return nil
}
return errors.TelemetryFailed
}