Keep server details out of API answers
An unexpected error now sends a general message, and the log keeps the text. A job no longer shows the path of its uploaded file. A cover is cached only by the browser of the user.
This commit is contained in:
@@ -145,8 +145,9 @@ def test_download_builds_from_stored_chapters_without_changing_them(client, stor
|
||||
response.close()
|
||||
|
||||
|
||||
def test_unexpected_backend_error_returns_json(client, monkeypatch):
|
||||
def test_unexpected_backend_error_returns_json(client, monkeypatch, caplog):
|
||||
monkeypatch.setattr(o, "list_stories", Mock(side_effect=RuntimeError("broken")))
|
||||
response = client.get("/api/stories")
|
||||
assert response.status_code == 500
|
||||
assert response.json == {"error": "RuntimeError: broken"}
|
||||
assert response.json == {"error": "Bindery hit an unexpected error. The log has the details."}
|
||||
assert "RuntimeError: broken" in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user