Use %w in file ingame.go and nbt package, then we can use errors.Is for compare

This commit is contained in:
Tnze
2020-03-04 12:37:43 +08:00
parent 7defd6062c
commit a908a03fcd
2 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ func (d *Decoder) Decode(v interface{}) error {
//start read NBT
tagType, tagName, err := d.readTag()
if err != nil {
return fmt.Errorf("nbt: %v", err)
return fmt.Errorf("nbt: %w", err)
}
if c := d.checkCompressed(tagType); c != "" {
@ -32,7 +32,7 @@ func (d *Decoder) Decode(v interface{}) error {
err = d.unmarshal(val.Elem(), tagType, tagName)
if err != nil {
return fmt.Errorf("nbt: %v", err)
return fmt.Errorf("nbt: %w", err)
}
return nil
}