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

me.alidg.errors.annotation.ExceptionMapping Maven / Gradle / Ivy

Go to download

A Spring Boot starter which provides a few primitives to handle exceptions more elegantly.

The newest version!
package me.alidg.errors.annotation;

import org.springframework.http.HttpStatus;

import java.lang.annotation.*;

/**
 * When an exception annotated with this annotation happens, the metadata encapsulated
 * in the annotation would help us to transform the language level exception to REST API
 * error code/status code combination.
 *
 * @author Ali Dehghani
 * @see ExposeAsArg
 * @see me.alidg.errors.handlers.AnnotatedWebErrorHandler
 */
@Inherited
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExceptionMapping {

    /**
     * Corresponding HTTP status code for this particular exception.
     *
     * @return The error code.
     */
    String errorCode();

    /**
     * The mapping error code for this exception.
     *
     * @return The status code.
     */
    HttpStatus statusCode();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy