Skip to content

Commit

Permalink
z1876 - remove printing null metadata, zcli part
Browse files Browse the repository at this point in the history
  • Loading branch information
tikinang committed Oct 6, 2022
1 parent 4f81b5f commit cd51959
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.12.13] - 2022-10-06

### Fixed
- remove printing null or empty error meta

## [v0.12.12] - 2022-10-06

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/metaError/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

type apiError interface {
GetMeta() interface{}
GetMeta() any
GetMessage() string
}

Expand Down
11 changes: 7 additions & 4 deletions src/proto/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type handleGrpcErrorConfig struct {

type Error struct {
Message string
Meta interface{}
Meta any
}

func (e Error) Error() string {
Expand All @@ -31,7 +31,7 @@ func (e Error) GetMessage() string {
return e.Message
}

func (e Error) GetMeta() interface{} {
func (e Error) GetMeta() any {
return e.Meta
}

Expand Down Expand Up @@ -79,10 +79,13 @@ func GrpcError[T errorCode, R response[T]](

noErrorCode := 0
if resp.GetError().GetCodeInt() != noErrorCode {
return Error{
Meta: json.RawMessage(resp.GetError().GetMeta()),
zcliErr := Error{
Message: resp.GetError().GetMessage(),
}
if meta := resp.GetError().GetMeta(); meta != nil {
zcliErr.Meta = json.RawMessage(meta)
}
return zcliErr
}

return nil
Expand Down

0 comments on commit cd51959

Please sign in to comment.