Skip to content

Commit

Permalink
Fix: always add context to errors during block serde
Browse files Browse the repository at this point in the history
Signed-off-by: kayos@tcp.direct <kayos@tcp.direct>
  • Loading branch information
yunginnanet committed Feb 7, 2024
1 parent 86cd1bd commit 53178c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions block_conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package slack

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

Expand Down Expand Up @@ -133,7 +132,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 @@ -431,7 +430,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 53178c2

Please sign in to comment.