]> Sergey Matveev's repositories - btrtrc.git/blobdiff - bencode/api.go
bencode: Improve UnmarshalTypeError string and list parsing error context
[btrtrc.git] / bencode / api.go
index 15687a8ce31e14ebb6726a1d11423c0ae95dcd6d..3e3c1633b39d63f02ebbdf9b8fb625bed17bc616 100644 (file)
@@ -46,8 +46,7 @@ type UnmarshalTypeError struct {
 }
 
 func (e *UnmarshalTypeError) Error() string {
-       return "bencode: value (" + e.Value + ") is not appropriate for type: " +
-               e.Type.String()
+       return fmt.Sprintf("cannot unmarshal a bencode %s into a %s", e.Value, e.Type)
 }
 
 // Unmarshaler tried to write to an unexported (therefore unwritable) field.