All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.logdoc.fairhttp.helpers.FairErrorHandler Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package org.logdoc.fairhttp.helpers;

import org.logdoc.fairhttp.diag.CallData;

/**
 * @author Denis Danilin | [email protected]
 * 07.01.2023 17:46
 * fairhttp ☭ sweat and blood
 */
public interface FairErrorHandler {
    default boolean breakOnHttpErrors() {
        return false;
    }

    default Class throwOnHttpErrors() {
        return IllegalStateException.class;
    }

    default boolean isError(final int httpStatusCode) {
        return httpStatusCode <= 0 || httpStatusCode >= 400;
    }

    void notification(NotificationLevel level, String notification, CallData callData);

    void exception(String details, Throwable t, CallData callData);

    enum NotificationLevel {
        INFO, WARN, ERROR
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy