Skip to content

Commit

Permalink
Add remoteObjectParseError
Browse files Browse the repository at this point in the history
This error can be used to encapsulate the details when a remote object
can not be parsed successfully.
  • Loading branch information
ankur22 committed Dec 15, 2023
1 parent a84a546 commit c575ce8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions common/remote_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ func multierror(err error, errs ...error) error {
return me
}

type remoteObjectParseError struct {
error
typ string
subType string
val string
}

// Error returns a string representation of the error.
func (e *remoteObjectParseError) Error() string {
return fmt.Sprintf("parsing remote object with type: %s subtype: %s val: %s err: %s",
e.typ, e.subType, e.val, e.error.Error())
}

// Unwrap returns the wrapped parsing error.
func (e *remoteObjectParseError) Unwrap() error {
return e.error
}

func parseRemoteObjectPreview(op *cdpruntime.ObjectPreview) (map[string]any, error) {
obj := make(map[string]any)
var result error
Expand Down

0 comments on commit c575ce8

Please sign in to comment.