Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate block/element support before sending to slack #16

Open
nwilging opened this issue Apr 23, 2022 · 0 comments
Open

validate block/element support before sending to slack #16

nwilging opened this issue Apr 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@nwilging
Copy link
Owner

elements have a compatibleWith method which returns an array of block types. Both elements and blocks have a getType method that will return the block or element's type.

Since slack only supports certain elements within certain blocks, a request exception would be thrown if a message was sent with an incompatible element within a block.

Before making the message request we should validate the incoming blocks and ensure that each element within them is compatible with the block it is part of. To keep things seamless I think we should go ahead and filter out the incompatible elements and just send the blocks array with compatible elements. This would at least allow partial messages to come through.

Alternatively we could throw an InvalidArgumentException specifying the invalid elements. This would result in end users not receiving messages (even partial messages) if there is an invalid element in a block. An error should be logged to the end user's error log, at which point the developer could make changes to their notification setup.

@nwilging nwilging added the enhancement New feature or request label Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant