Fixes JSON formatting in specs.
Fixes JSHint warning about using variable named 'error' inside catch block.