It is better to die() than to return() falsely.

Maybe something like: return {'Error': 'Whatever the error is'}