Enable stacktraces and causal chain of causes. Add a couple of tests to validate stacktrace and cause are included in responses (#6315)
This commit is contained in:
+7
@@ -5,5 +5,12 @@ import org.zalando.problem.spring.web.advice.ProblemHandling;
|
||||
|
||||
@ControllerAdvice
|
||||
public class ExceptionHandler implements ProblemHandling {
|
||||
|
||||
// The causal chain of causes is disabled by default,
|
||||
// but we can easily enable it by overriding the behavior:
|
||||
@Override
|
||||
public boolean isCausalChainsEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -12,6 +12,8 @@ public class ProblemDemoConfiguration {
|
||||
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
return new ObjectMapper().registerModules(new ProblemModule(), new ConstraintViolationProblemModule());
|
||||
// In this example, stack traces support is enabled by default.
|
||||
// If you want to disable stack traces just use new ProblemModule() instead of new ProblemModule().withStackTraces()
|
||||
return new ObjectMapper().registerModules(new ProblemModule().withStackTraces(), new ConstraintViolationProblemModule());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user