You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "wolfboys (via GitHub)" <gi...@apache.org> on 2023/02/18 13:56:52 UTC

[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #2340: [Improve][Issue 2325] Change the corresponding lines about exception throw for fine users Interaction

wolfboys commented on code in PR #2340:
URL: https://github.com/apache/incubator-streampark/pull/2340#discussion_r1111036317


##########
streampark-common/src/main/java/org/apache/streampark/common/util/ExceptionGetter.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.streampark.common.util;
+
+import javax.annotation.Nonnull;
+
+/** A interface to define the action to create a exception with specified error message. */
+public interface ExceptionGetter {
+
+  @Nonnull
+  Exception get(String errorMsg);
+}

Review Comment:
   thanks for your contribution, I don't quite agree with this method, we just need to add method in ApiAlertException and ApiDetailException, such as:
   
   ```
     public static void throwIfNull(Object object, String message) {
            if (object == null) {
                throw new ApiAlertException(message);
            }
        }
   ```
   how to use:
   ```
   ApiAlertException.throwIfNull(executionMode, "executionMode cannot be null");
   ```
   
   Would this be simpler?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org