Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Do not log stack trace when event type does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Montrieux committed Apr 10, 2018
1 parent fb54e61 commit ae0871e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.6.3] = 2018-04-10

### Fixed
- Do not log a complete stack trace when a user tries to publish to a non-existing event type

## [2.6.2] - 2018-04-05

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private ResponseEntity postEventInternal(final String eventTypeName,
LOG.debug("Problem parsing event", e);
return processJSONException(e, nativeWebRequest);
} catch (final NoSuchEventTypeException e) {
LOG.debug("Event type not found.", e);
LOG.debug("Event type not found.", e.getMessage());
return create(e.asProblem(), nativeWebRequest);
} catch (final NakadiException e) {
LOG.debug("Failed to publish batch", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public EventType findByName(final String name) throws NoSuchEventTypeException {
try {
return jdbcTemplate.queryForObject(sql, new Object[]{name}, new EventTypeMapper());
} catch (EmptyResultDataAccessException e) {
throw new NoSuchEventTypeException("EventType \"" + name + "\" does not exist.", e);
throw new NoSuchEventTypeException("EventType \"" + name + "\" does not exist.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void createTimeline(final String eventTypeName, final String storageId)
} catch (final TopicCreationException | ServiceUnavailableException | InternalNakadiException e) {
throw new TimelineException("Internal service error", e);
} catch (final NoSuchEventTypeException e) {
throw new NotFoundException("EventType \"" + eventTypeName + "\" does not exist", e);
throw new NotFoundException("EventType \"" + eventTypeName + "\" does not exist");
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ public List<Timeline> getTimelines(final String eventTypeName)
final EventType eventType = eventTypeCache.getEventType(eventTypeName);
return timelineDbRepository.listTimelinesOrdered(eventType.getName());
} catch (final NoSuchEventTypeException e) {
throw new NotFoundException("EventType \"" + eventTypeName + "\" does not exist", e);
throw new NotFoundException("EventType \"" + eventTypeName + "\" does not exist");
} catch (final InternalNakadiException e) {
throw new TimelineException("Could not get event type: " + eventTypeName, e);
}
Expand Down

0 comments on commit ae0871e

Please sign in to comment.