Passing error to JSON and also displaying error in front-end code closes #117