Return null rather than throwing an exception for unknown event type

Closes gh-6
This commit is contained in:
Andy Wilkinson
2018-12-06 21:02:17 +00:00
parent 5c78afe490
commit f33eeb4494

View File

@@ -20,6 +20,8 @@ import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An event that has been performed on an {@link Issue}.
@@ -28,6 +30,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/
public class Event {
private static final Logger log = LoggerFactory.getLogger(Event.class);
private final Type type;
private final OffsetDateTime creationTime;
@@ -220,8 +224,10 @@ public class Event {
return value;
}
}
throw new IllegalArgumentException(
"'" + type + "' is not a valid event type");
if (log.isInfoEnabled()) {
log.info("Received unknown event type '" + type + "'");
}
return null;
}
}