Skip to content

Commit

Permalink
Add Exception to CommandError for the better error message. (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitryhil committed Sep 6, 2023
1 parent c77e440 commit e1d40cf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions websockets/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ type Syncer interface {
}

type CommandError struct {
Name string `json:"error"`
Code int `json:"error_code"`
Message string `json:"error_message"`
Name string `json:"error"`
Code int `json:"error_code"`
Message string `json:"error_message"`
Exception string `json:"error_exception"`
}

type Command struct {
Expand Down Expand Up @@ -48,7 +49,7 @@ func (c *Command) IncrementId() {
}

func (e *CommandError) Error() string {
return fmt.Sprintf("%s %d %s", e.Name, e.Code, e.Message)
return fmt.Sprintf("%s %d %s %s", e.Name, e.Code, e.Message, e.Exception)
}

func newCommand(command string) *Command {
Expand Down

0 comments on commit e1d40cf

Please sign in to comment.