Search in sources :

Example 1 with EventNotFoundException

use of io.gravitee.management.service.exceptions.EventNotFoundException in project gravitee-management-rest-api by gravitee-io.

the class EventServiceImpl method findById.

@Override
public EventEntity findById(String id) {
    try {
        LOGGER.debug("Find event by ID: {}", id);
        Optional<Event> event = eventRepository.findById(id);
        if (event.isPresent()) {
            return convert(event.get());
        }
        throw new EventNotFoundException(id);
    } catch (TechnicalException ex) {
        LOGGER.error("An error occurs while trying to find an event using its ID {}", id, ex);
        throw new TechnicalManagementException("An error occurs while trying to find an event using its ID " + id, ex);
    }
}
Also used : TechnicalException(io.gravitee.repository.exceptions.TechnicalException) Event(io.gravitee.repository.management.model.Event) EventNotFoundException(io.gravitee.management.service.exceptions.EventNotFoundException) TechnicalManagementException(io.gravitee.management.service.exceptions.TechnicalManagementException)

Aggregations

EventNotFoundException (io.gravitee.management.service.exceptions.EventNotFoundException)1 TechnicalManagementException (io.gravitee.management.service.exceptions.TechnicalManagementException)1 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)1 Event (io.gravitee.repository.management.model.Event)1