mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	push_notifs: Improve error responses from /test_notification endpoint.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							d43be2b7c4
						
					
				
				
					commit
					7604c7935c
				
			@@ -92,6 +92,17 @@ def send_to_push_bouncer(
 | 
			
		||||
            raise PushNotificationBouncerError(
 | 
			
		||||
                _("Push notifications bouncer error: {error}").format(error=msg)
 | 
			
		||||
            )
 | 
			
		||||
        elif (
 | 
			
		||||
            endpoint == "push/test_notification"
 | 
			
		||||
            and "code" in result_dict
 | 
			
		||||
            and result_dict["code"] == "INVALID_REMOTE_PUSH_DEVICE_TOKEN"
 | 
			
		||||
        ):
 | 
			
		||||
            # This error from the notification debugging endpoint should just be directly
 | 
			
		||||
            # communicated to the device.
 | 
			
		||||
            # TODO: Extend this to use a more general mechanism when we add more such error responses.
 | 
			
		||||
            from zerver.lib.push_notifications import InvalidRemotePushDeviceTokenError
 | 
			
		||||
 | 
			
		||||
            raise InvalidRemotePushDeviceTokenError
 | 
			
		||||
        else:
 | 
			
		||||
            # But most other errors coming from the push bouncer
 | 
			
		||||
            # server are client errors (e.g. never-registered token)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user