ivanzlenko commented on code in PR #5574:
URL: https://github.com/apache/ignite-3/pull/5574#discussion_r2031446231


##########
modules/core/src/main/java/org/apache/ignite/internal/failure/FailureProcessorUtils.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.failure;
+
+import static org.apache.ignite.internal.failure.FailureType.CRITICAL_ERROR;
+import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR;
+
+import org.apache.ignite.internal.lang.IgniteInternalException;
+
+/**
+ * Utils making it easier to report failures with {@link FailureProcessor}.
+ */
+public class FailureProcessorUtils {
+    /**
+     * Reports a failure to a failure processor capturing the call site 
context.
+     *
+     * @param processor Processor used to process the failure.
+     * @param th The failure.
+     * @param messageFormat Message format (same as {@link 
String#format(String, Object...)} accepts).
+     * @param args Arguments for the message.
+     */
+    public static void processCriticalFailure(FailureProcessor processor, 
Throwable th, String messageFormat, Object... args) {
+        processor.process(new FailureContext(CRITICAL_ERROR,
+                new IgniteInternalException(INTERNAL_ERR, 
String.format(messageFormat, args))

Review Comment:
   If we will count all changes my guts telling me that 1/4 of 1,227 changes in 
the code itself will be just changing {} to %s. You could've avoid it by using 
IgniteStringFormatter instead. 



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to