Fix weird observer subscribe return

This commit is contained in:
kozabrada123 2023-05-28 17:37:05 +02:00
parent 982e85af9e
commit c4a6b85e1e
1 changed files with 3 additions and 3 deletions

View File

@ -1322,13 +1322,13 @@ impl<T: types::WebSocketEvent> GatewayEvent<T> {
pub fn subscribe(
&mut self,
observable: Arc<Mutex<dyn Observer<T> + Sync + Send>>,
) -> Option<ObserverError> {
) -> Result<(), ObserverError> {
if self.is_observed {
return Some(ObserverError::AlreadySubscribedError);
return Err(ObserverError::AlreadySubscribedError);
}
self.is_observed = true;
self.observers.push(observable);
None
Ok(())
}
/**