Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
fix err msg
Browse files Browse the repository at this point in the history
  • Loading branch information
larscom committed Dec 2, 2023
1 parent 3e336bd commit e75d59a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jsond/error.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package jsond

import "fmt"
import (
"fmt"

"github.com/larscom/go-bitvavo/v2/util"
)

type BitvavoErr struct {
Code int `json:"errorCode"`
Expand All @@ -9,5 +13,6 @@ type BitvavoErr struct {
}

func (b *BitvavoErr) Error() string {
return fmt.Sprintf("Error %d: %s. Action: %s", b.Code, b.Message, b.Action)
msg := fmt.Sprintf("code %d: %s", b.Code, b.Message)
return fmt.Sprint(util.IfOrElse(len(b.Action) > 0, func() string { return fmt.Sprintf("%s action: %s", msg, b.Action) }, msg))
}

0 comments on commit e75d59a

Please sign in to comment.