A solution is to do the verifying yourself or with a script beforehand and pass the valid files via the --input argument to the Typst file (docs: System Functions – Typst Documentation)
I highly recommend to only use assets which are available to you in a Typst project either from yourself or from packages, instead of relying on a try-catch basis. Meaning, if you provide content through a script or similar, name it accordingly and work with the --input parameter provided by the Typst app.
Typst at the end of the day is a type-setting system.