Skip to content

Commit

Permalink
epoch: detect strconv.ParseInt error and propagate
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Feb 12, 2018
1 parent 1356916 commit f3b34ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions epoch_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func (t *EpochTime) UnmarshalJSON(b []byte) (err error) {
}

secs, err := strconv.ParseInt(string(b), 0, 64)
if err == nil {
if err != nil {
t.Time = time.Time{}
return nil
return err
}

t.Time = time.Unix(secs, 0)
Expand Down

0 comments on commit f3b34ed

Please sign in to comment.