Raising errors in inventory scripts

Hello,
is there a proper way to report errors in dynamic inventory script? Somehow so that Ansible shows the error message to the user, rather than trying to parse it as JSON.

I didn’t take a very deep look. I just saw that the ec2 script prints to stdout and exits with “1” exit status. Is that how it should be?

Thanks,
Tomas