package com.mycompany.myapp.web.rest.errors; /** * Custom, parameterized exception, which can be translated on the client side. * For example: * * <pre> * throw new CustomParameterizedException("myCustomError", "hello", "world"); * </pre> * * Can be translated with: * * <pre> * "error.myCustomError" : "The server says {{params[0]}} to {{params[1]}}" * </pre> */ public class CustomParameterizedException extends RuntimeException { private static final long serialVersionUID = 1L; private final String message; private final String[] params; public CustomParameterizedException(String message, String... params) { super(message); this.message = message; this.params = params; } public ParameterizedErrorDTO getErrorDTO() { return new ParameterizedErrorDTO(message, params); } }