Create App Services trigger to prevent invalid data

Hi,

Is there a way to have an insert/update trigger that cancels the update or insert if the underlying function detects invalid data in the document? Or is this not the intention of triggers and so not supported?

Thanks for your insights!