org.a3badran.platform.logging.ErrorHandler.java Source code

Java tutorial

Introduction

Here is the source code for org.a3badran.platform.logging.ErrorHandler.java

Source

/**
 * Copyright (c) 2013 Ahmed Badran (a3badran). This content is released under the MIT License. See LICENCE.txt
 */
package org.a3badran.platform.logging;

import org.springframework.stereotype.Component;

@Component
public class ErrorHandler implements RequestErrorHandler {

    @Override
    public void handleError(Throwable t) {
        if (t instanceof IllegalStateException) {
            RequestLogger.addWarning(t.toString());
        } else {
            RequestLogger.addError(t.toString());
        }
    }

}