Log exceptions thrown from events. (#1187)

Closes #1075.
This commit is contained in:
Michael Reiche
2021-08-16 13:15:22 -07:00
committed by GitHub
parent 5e92a99996
commit f8b5ab205c
2 changed files with 4 additions and 12 deletions

View File

@@ -182,7 +182,7 @@ class CouchbaseTemplateSupport implements ApplicationContextAware, TemplateSuppo
try {
this.applicationContext.publishEvent(event);
} catch (Exception e) {
e.printStackTrace();
LOG.error("exception emitting event "+event, e);
}
} else {
LOG.info("maybeEmitEvent called, but CouchbaseTemplate not initialized with applicationContext");
@@ -196,11 +196,7 @@ class CouchbaseTemplateSupport implements ApplicationContextAware, TemplateSuppo
protected <T> T maybeCallBeforeConvert(T object, String collection) {
if (entityCallbacks != null) {
try {
return entityCallbacks.callback(BeforeConvertCallback.class, object, collection);
} catch (Exception e) {
e.printStackTrace();
}
return entityCallbacks.callback(BeforeConvertCallback.class, object, collection);
} else {
LOG.info("maybeCallBeforeConvert called, but CouchbaseTemplate not initialized with applicationContext");
}

View File

@@ -189,7 +189,7 @@ class ReactiveCouchbaseTemplateSupport implements ApplicationContextAware, React
try {
this.applicationContext.publishEvent(event);
} catch (Exception e) {
e.printStackTrace();
LOG.error("exception emitting event "+event, e);
}
} else {
LOG.info("maybeEmitEvent called, but ReactiveCouchbaseTemplate not initialized with applicationContext");
@@ -203,11 +203,7 @@ class ReactiveCouchbaseTemplateSupport implements ApplicationContextAware, React
protected <T> Mono<T> maybeCallBeforeConvert(T object, String collection) {
if (reactiveEntityCallbacks != null) {
try {
return reactiveEntityCallbacks.callback(ReactiveBeforeConvertCallback.class, object, collection);
} catch (Exception e) {
e.printStackTrace();
}
return reactiveEntityCallbacks.callback(ReactiveBeforeConvertCallback.class, object, collection);
} else {
LOG.info("maybeCallBeforeConvert called, but ReactiveCouchbaseTemplate not initialized with applicationContext");
}