Skip to content

Commit

Permalink
Merge pull request #1259 from yunginnanet/master
Browse files Browse the repository at this point in the history
Fix: always add context to errors during block serde
  • Loading branch information
parsley42 committed Feb 10, 2024
2 parents 9d132f3 + 53178c2 commit 15f367e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions block_conv.go
Expand Up @@ -2,7 +2,6 @@ package slack

import (
"encoding/json"
"errors"
"fmt"
)

Expand Down Expand Up @@ -137,7 +136,7 @@ func (b *InputBlock) UnmarshalJSON(data []byte) error {
case "number_input":
e = &NumberInputBlockElement{}
default:
return errors.New("unsupported block element type")
return fmt.Errorf("unsupported block element type %v", s.TypeVal)
}

if err := json.Unmarshal(a.Element, e); err != nil {
Expand Down Expand Up @@ -443,7 +442,7 @@ func (e *ContextElements) UnmarshalJSON(data []byte) error {

e.Elements = append(e.Elements, elem.(*ImageBlockElement))
default:
return errors.New("unsupported context element type")
return fmt.Errorf("unsupported context element type %v", contextElementType)
}
}

Expand Down

0 comments on commit 15f367e

Please sign in to comment.