From 29d275f2f7fa47050e942f712ee08506a239a213 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Tue, 18 May 2021 09:57:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/handler/annotation/I18n.java | 14 +++++++++++ .../dataease/exception/DataEaseException.java | 24 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 backend/src/main/java/io/dataease/controller/handler/annotation/I18n.java create mode 100644 backend/src/main/java/io/dataease/exception/DataEaseException.java diff --git a/backend/src/main/java/io/dataease/controller/handler/annotation/I18n.java b/backend/src/main/java/io/dataease/controller/handler/annotation/I18n.java new file mode 100644 index 0000000000..f22d6c4b98 --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/handler/annotation/I18n.java @@ -0,0 +1,14 @@ +package io.dataease.controller.handler.annotation; + + +import io.dataease.commons.constants.I18nConstants; + +import java.lang.annotation.*; + +@Documented +@Inherited +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface I18n { + String value() default I18nConstants.LANG_COOKIE_NAME; +} diff --git a/backend/src/main/java/io/dataease/exception/DataEaseException.java b/backend/src/main/java/io/dataease/exception/DataEaseException.java new file mode 100644 index 0000000000..882ac0f3c7 --- /dev/null +++ b/backend/src/main/java/io/dataease/exception/DataEaseException.java @@ -0,0 +1,24 @@ +package io.dataease.exception; + +public class DataEaseException extends RuntimeException { + + private DataEaseException(String message) { + super(message); + } + + private DataEaseException(Throwable t) { + super(t); + } + + public static void throwException(String message) { + throw new DataEaseException(message); + } + + public static DataEaseException getException(String message) { + throw new DataEaseException(message); + } + + public static void throwException(Throwable t) { + throw new DataEaseException(t); + } +}