summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5cvt.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5cvt.go')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5cvt.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5cvt.go b/src/hub/src/spreadspace.org/sfive/s5cvt.go
index 5a2ef70..d828af7 100644
--- a/src/hub/src/spreadspace.org/sfive/s5cvt.go
+++ b/src/hub/src/spreadspace.org/sfive/s5cvt.go
@@ -20,13 +20,14 @@ type PlainDecoder struct{}
type PlainEncoder struct{}
-func NewStatefulDecoder(jsonString []byte) (decoder StatsDecoder) {
+func NewStatefulDecoder(jsonString []byte) (decoder StatsDecoder, err error) {
res := new(StatefulDecoder)
- err := json.Unmarshal(jsonString, &res.sourceId)
+ err = json.Unmarshal(jsonString, &res.sourceId)
if err != nil {
- return nil
+ return
}
- return res
+ decoder = res
+ return
}
func NewPlainDecoder() (decoder StatsDecoder) {
@@ -35,10 +36,9 @@ func NewPlainDecoder() (decoder StatsDecoder) {
func (self *StatefulDecoder) Decode(jsonString []byte) (dat StatisticsData, err error) {
err = json.Unmarshal(jsonString, &dat)
- if err != nil {
- return
- }
dat.CopyFrom(&self.sourceId)
+ // like in PlainDecoder, let the client decide how to use partial results
+ // (Unmarshal returns partial results in case of errors)
return
}