Example usage for org.springframework.boot.diagnostics FailureAnalysis FailureAnalysis

List of usage examples for org.springframework.boot.diagnostics FailureAnalysis FailureAnalysis

Introduction

In this page you can find the example usage for org.springframework.boot.diagnostics FailureAnalysis FailureAnalysis.

Prototype

public FailureAnalysis(String description, String action, Throwable cause) 

Source Link

Document

Creates a new FailureAnalysis with the given description and action , if any, that the user should take to address the problem.

Usage

From source file:com.example.autoconfigure.failureanalyzer.ModelMapConfigurationFailureAnalyzer.java

@Override
protected FailureAnalysis analyze(Throwable rootFailure, ConfigurationException cause) {
    StringBuilder description = new StringBuilder();
    description.append("ModelMapper configuration failed:\n");
    for (ErrorMessage message : cause.getErrorMessages()) {
        description.append(message.getMessage());
    }// www.j  ava 2  s . c o m
    return new FailureAnalysis(description.toString(), "Fix ModelMapper configuration", cause);
}

From source file:io.kamax.mxisd.spring.ConfigurationFailureAnalyzer.java

@Override
protected FailureAnalysis analyze(Throwable rootFailure, ConfigurationException cause) {
    String message = cause.getMessage();
    if (cause.getDetailedMessage().isPresent()) {
        message += " - " + cause.getDetailedMessage().get();
    }// w  w w.  ja  va2 s  .c o  m
    return new FailureAnalysis(message, "Double check the key value", cause);
}