exceptions: Add IncompatibleParametersError as a JsonableError.

Creates an IncompatibleParametersError to be used in cases where
there are two (or more) optional parameters for an endpoint that
are incompatible with each other, e.g. there's a parameter for a
user name and a user ID but only one should be sent in the request
to identify the user.

Documents the error on the /api/rest-error-handling article.

Updates the PATCH users/me/subscriptions/muted_topics endpoint to
use this error when both the stream and stream_id parameters are
passed (note this endpoint is currently deprecated).
This commit is contained in:
Lauryn Menard
2024-04-29 15:50:57 +02:00
committed by Tim Abbott
parent d79e84726a
commit 62e17c987f
4 changed files with 42 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ class MutedTopicsTestsDeprecated(ZulipTestCase):
data = {"stream": stream.name, "stream_id": stream.id, "topic": "Verona3", "op": "add"}
result = self.api_patch(user, url, data)
self.assert_json_error(result, "Please supply only one channel parameter: name or ID.")
self.assert_json_error(result, "Unsupported parameter combination: stream_id, stream")
data = {"stream_id": stream.id, "topic": "a" * (MAX_TOPIC_NAME_LENGTH + 1), "op": "add"}
result = self.api_patch(user, url, data)
@@ -238,7 +238,7 @@ class MutedTopicsTestsDeprecated(ZulipTestCase):
data = {"stream": stream.name, "stream_id": stream.id, "topic": "Verona3", "op": "remove"}
result = self.api_patch(user, url, data)
self.assert_json_error(result, "Please supply only one channel parameter: name or ID.")
self.assert_json_error(result, "Unsupported parameter combination: stream_id, stream")
data = {"stream_id": stream.id, "topic": "a" * (MAX_TOPIC_NAME_LENGTH + 1), "op": "remove"}
result = self.api_patch(user, url, data)