added an error listener for compilation, and proper error status code for response