mike-jumper commented on code in PR #758: URL: https://github.com/apache/guacamole-client/pull/758#discussion_r951974382
########## guacamole-ext/src/main/java/org/apache/guacamole/net/event/FailureEvent.java: ########## @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.net.event; + +/** + * An event which represents failure of an operation, where that failure may + * be associated with a particular Throwable. + */ +public interface FailureEvent { Review Comment: The pattern that's been applied for events received by `Listener` has been to abstract away just about every aspect of the event into a separate interface, to ensure that `Listener` implementations can test for and handle received events based on any common aspect they might be interested in: * [`CredentialEvent`](https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/event/CredentialEvent.html) * [`TunnelEvent`](https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/event/TunnelEvent.html) * [`UserEvent`](https://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/event/UserEvent.html) `AuthenticationProviderEvent` and `FailureEvent` were added here with this pattern in mind. Implementations of `Listener` that are interested in failures of any kind can simply listen for `FailureEvent` and rely on receiving those events, even if new failure-type events are introduced in the future, and the number of `instanceof` checks can be kept minimal. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
