Advanced flow, how to return an error?

I use the advanced flow cards and i do a http request to a (php) script on an server, sometimes i need to stop the flow card if something goes wrong in the script so i wish to return an error.

What do i exactly return in the script to error the advanced http get flow card?
I tried:
http_response_code(400); // also tried several error codes
$return[‘result’] = ‘false’;
$return[‘msg’] = ‘error kon commando niet uitvoeren’;
echo json_encode($return);

But this does not work, the advanced card stil continues ‘normally’…

I think you’re using Homey Script?

Try to throw an error

throw new Error("My Error");

I do have homeyscript installed but not using it, this what i do:

The card it self works, it calls the url and the script is executed, but sometimes i need to send a error back so the ‘red’ line is triggered because there was an error.

That will not work. It would throw an error if the http request fails (Timeout, 404 etc)