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

sirius.web.ErrorCodeException Maven / Gradle / Ivy

There is a newer version: 22.2.3
Show newest version
/*
 * Made with all the love in the world
 * by scireum in Remshalden, Germany
 *
 * Copyright by scireum GmbH
 * http://www.scireum.de - [email protected]
 */

package sirius.web;

import sirius.kernel.health.HandledException;
import sirius.web.controller.Routed;

/**
 * Can be thrown in {@link sirius.web.services.StructuredService}s or in JSON calls ({@link Routed#jsonCall()}).
 * 

* Adds an additional "code" property to the JSON result which contains the given code. Also the given message * is directly reported without any translation or logging. */ public class ErrorCodeException extends HandledException { private static final long serialVersionUID = -5345498530492414479L; private final String code; /** * Creates a new exception with the given code and message. *

* Note tha this is a HandledException so no further logging or error reporting will be performed by the * system. * * @param code the error code to report * @param message the message to add to the output */ public ErrorCodeException(String code, String message) { super(message); this.code = code; } /** * Obtains the error code of this exception. * * @return the error code being reported */ public String getCode() { return code; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy