convert server error into json response, refs #18