This is an automated email from the ASF dual-hosted git repository.
ascherbakov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 7710e15 IGNITE-14495 Add common internal exceptions (#85).
7710e15 is described below
commit 7710e15e3063ebdefb03a25963b8b437c3400810
Author: Alexey Scherbakov <[email protected]>
AuthorDate: Wed Apr 7 11:56:06 2021 +0300
IGNITE-14495 Add common internal exceptions (#85).
---
modules/core/pom.xml | 5 +-
.../lang/IgniteInternalCheckedException.java | 80 ++++++++++++++++++++++
.../ignite/lang/IgniteInternalException.java | 69 +++++++++++++++++++
3 files changed, 153 insertions(+), 1 deletion(-)
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index c84ded1..c311ec1 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -41,12 +41,15 @@
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git
a/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalCheckedException.java
b/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalCheckedException.java
new file mode 100644
index 0000000..fe09192
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalCheckedException.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.lang;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * General internal checked exception. This exception is used to indicate any
error condition within the node.
+ */
+public class IgniteInternalCheckedException extends Exception {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates an empty exception.
+ */
+ public IgniteInternalCheckedException() {
+ // No-op.
+ }
+
+ /**
+ * Creates a new exception with the given error message.
+ *
+ * @param msg Error message.
+ */
+ public IgniteInternalCheckedException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates a new grid exception with the given throwable as a cause and
+ * source of error message.
+ *
+ * @param cause Non-null throwable cause.
+ */
+ public IgniteInternalCheckedException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+ /**
+ * Creates a new exception with the given error message and optional
nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be {@code null}).
+ * @param writableStackTrace Whether or not the stack trace should be
writable.
+ */
+ public IgniteInternalCheckedException(String msg, @Nullable Throwable
cause, boolean writableStackTrace) {
+ super(msg, cause, true, writableStackTrace);
+ }
+
+ /**
+ * Creates a new exception with the given error message and optional
nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be {@code null}).
+ */
+ public IgniteInternalCheckedException(String msg, @Nullable Throwable
cause) {
+ super(msg, cause);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return getClass() + ": " + getMessage();
+ }
+}
diff --git
a/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalException.java
b/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalException.java
new file mode 100644
index 0000000..25a3cd3
--- /dev/null
+++
b/modules/core/src/main/java/org/apache/ignite/lang/IgniteInternalException.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.lang;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * General internal exception. This exception is used to indicate any error
condition within the node.
+ */
+public class IgniteInternalException extends RuntimeException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates an empty exception.
+ */
+ public IgniteInternalException() {
+ // No-op.
+ }
+
+ /**
+ * Creates a new exception with the given error message.
+ *
+ * @param msg Error message.
+ */
+ public IgniteInternalException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates a new grid exception with the given throwable as a cause and
+ * source of error message.
+ *
+ * @param cause Non-null throwable cause.
+ */
+ public IgniteInternalException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+ /**
+ * Creates a new exception with the given error message and optional
nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be {@code null}).
+ */
+ public IgniteInternalException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return getClass() + ": " + getMessage();
+ }
+}