From 342cc122b43f01301d0188de1e333c32ed64ae8c Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 4 Aug 2014 16:25:53 +0200 Subject: Added general Pipe API --- ethutil/value.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ethutil') diff --git a/ethutil/value.go b/ethutil/value.go index 3128cd724..2233b978c 100644 --- a/ethutil/value.go +++ b/ethutil/value.go @@ -122,6 +122,14 @@ func (val *Value) Bytes() []byte { return []byte{} } +func (val *Value) Err() error { + if err, ok := val.Val.(error); ok { + return err + } + + return nil +} + func (val *Value) Slice() []interface{} { if d, ok := val.Val.([]interface{}); ok { return d @@ -157,6 +165,11 @@ func (val *Value) IsStr() bool { return val.Type() == reflect.String } +func (self *Value) IsErr() bool { + _, ok := self.Val.(error) + return ok +} + // Special list checking function. Something is considered // a list if it's of type []interface{}. The list is usually // used in conjunction with rlp decoded streams. -- cgit