]> Sergey Matveev's repositories - btrtrc.git/blobdiff - bencode/decode.go
bencode: Improve UnmarshalTypeError string and list parsing error context
[btrtrc.git] / bencode / decode.go
index 03488999f756d92524e5cb2b7d3f8926194949b8..13e63f71e74afc9ba5829beb380fbb77bba5bdbe 100644 (file)
@@ -346,10 +346,10 @@ func (d *Decoder) parseList(v reflect.Value) error {
        switch v.Kind() {
        case reflect.Array, reflect.Slice:
        default:
-               panic(&UnmarshalTypeError{
-                       Value: "array",
+               return &UnmarshalTypeError{
+                       Value: "list",
                        Type:  v.Type(),
-               })
+               }
        }
 
        i := 0