Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 417cdbd

Browse files
committed
Add verbose handling
1 parent b0c83ef commit 417cdbd

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

internal/cmd/envs.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,32 @@ func handleTemplateError(origError error) error {
410410
}
411411

412412
// TODO: Handle verbose case here too?
413-
if ae.Err.Code == "wac_template" {
414-
type payload struct {
413+
switch ae.Err.Code {
414+
case "wac_template":
415+
type templatePayload struct {
415416
ErrorType string `json:"error_type"`
416417
Msgs []string `json:"messages"`
417418
}
418419

419-
var p payload
420+
var p templatePayload
420421
err := json.Unmarshal(ae.Err.Details, &p)
421422
if err != nil {
422423
return origError
423424
}
424425

425426
return clog.Error(p.ErrorType, p.Msgs...)
427+
case "verbose":
428+
// TODO: We should move this to some general spot to decode this
429+
type verbosePayload struct {
430+
Verbose string `json:"verbose"`
431+
}
432+
var p verbosePayload
433+
err := json.Unmarshal(ae.Err.Details, &p)
434+
if err != nil {
435+
return origError
436+
}
437+
438+
return clog.Error(origError.Error(), p.Verbose)
426439
}
427440

428441
return origError // Return the original

0 commit comments

Comments
 (0)