Change the return to a json file

It now reports the exception and details of the exception.