Skip to content

Commit

Permalink
enhance error messages to know where they happened.
Browse files Browse the repository at this point in the history
  • Loading branch information
corylanou committed Apr 8, 2015
1 parent b244fac commit 8ca6ac3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ func (f *FieldCodec) EncodeFields(values map[string]interface{}) ([]byte, error)
buf[i+3] = byte(c)
}
default:
panic(fmt.Sprintf("unsupported value type: %T", v))
panic(fmt.Sprintf("unsupported value type during encode fields: %T", v))
}

// Always set the field ID as the leading byte.
Expand Down Expand Up @@ -868,7 +868,7 @@ func (f *FieldCodec) DecodeByID(targetID uint8, b []byte) (interface{}, error) {
// Move bytes forward.
b = b[size+3:]
default:
panic(fmt.Sprintf("unsupported value type: %T", field.Type))
panic(fmt.Sprintf("unsupported value type during decode by id: %T", field.Type))
}

if field.ID == targetID {
Expand Down Expand Up @@ -922,7 +922,7 @@ func (f *FieldCodec) DecodeFields(b []byte) (map[uint8]interface{}, error) {
// Move bytes forward.
b = b[size+3:]
default:
panic(fmt.Sprintf("unsupported value type: %T", f.fieldsByID[fieldID]))
panic(fmt.Sprintf("unsupported value type during decode fields: %T", f.fieldsByID[fieldID]))
}

values[fieldID] = value
Expand Down

0 comments on commit 8ca6ac3

Please sign in to comment.