mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
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:
committed by
Tim Abbott
parent
d79e84726a
commit
62e17c987f
@@ -7,6 +7,7 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from zerver.lib.default_streams import get_default_stream_ids_for_realm
|
||||
from zerver.lib.exceptions import (
|
||||
IncompatibleParametersError,
|
||||
JsonableError,
|
||||
OrganizationAdministratorRequiredError,
|
||||
OrganizationOwnerRequiredError,
|
||||
@@ -326,7 +327,7 @@ def check_for_exactly_one_stream_arg(stream_id: Optional[int], stream: Optional[
|
||||
raise JsonableError(error)
|
||||
|
||||
if stream_id is not None and stream is not None:
|
||||
raise JsonableError(_("Please supply only one channel parameter: name or ID."))
|
||||
raise IncompatibleParametersError(["stream_id", "stream"])
|
||||
|
||||
|
||||
def check_stream_access_for_delete_or_update(
|
||||
|
||||
Reference in New Issue
Block a user