Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
exceptions: Remove unused to_json method of JsonableError.
Anders Kaseorg27325eb2ae76
diff --git a/zerver/lib/exceptions.py b/zerver/lib/exceptions.pyindex eb953cb61e9..8a3d3775784 100644--- a/zerver/lib/exceptions.py+++ b/zerver/lib/exceptions.py@@ -118,11 +118,6 @@ class JsonableError(Exception):def data(self) -> Dict[str, Any]:return dict(((f, getattr(self, f)) for f in self.data_fields), code=self.code.name)- def to_json(self) -> Dict[str, Any]:- d = {"result": "error", "msg": self.msg}- d.update(self.data)- return d-def __str__(self) -> str:return self.msgdiff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex a24118b85d6..ebd16bbdfc4 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -57,6 +57,7 @@ from zerver.lib.remote_server import (send_analytics_to_remote_server,send_to_push_bouncer,)+from zerver.lib.response import json_response_from_errorfrom zerver.lib.soft_deactivation import do_soft_deactivate_usersfrom zerver.lib.test_classes import ZulipTestCasefrom zerver.lib.test_helpers import mock_queue_publish@@ -1948,8 +1949,8 @@ class TestSendToPushBouncer(ZulipTestCase):from zerver.decorator import InvalidZulipServerError# This is the exception our decorator uses for an invalid Zulip server- error_obj = InvalidZulipServerError("testRole")- self.add_mock_response(body=orjson.dumps(error_obj.to_json()), status=400)+ error_response = json_response_from_error(InvalidZulipServerError("testRole"))+ self.add_mock_response(body=error_response.content, status=error_response.status_code)with self.assertRaises(PushNotificationBouncerException) as exc:send_to_push_bouncer("POST", "register", {"msg": "true"})self.assertEqual(