You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/02/08 12:31:57 UTC

[GitHub] [ignite-3] sashapolo commented on a change in pull request #640: IGNITE-16495 Make RestModule handlers asynchronous

sashapolo commented on a change in pull request #640:
URL: https://github.com/apache/ignite-3/pull/640#discussion_r801581051



##########
File path: modules/rest/src/main/java/org/apache/ignite/internal/rest/RestModule.java
##########
@@ -232,34 +244,40 @@ private void handleRepresentByPath(
      * @param res          Rest response.
      * @param presentation Configuration presentation.
      */
-    private void handleUpdate(
+    private static CompletableFuture<RestApiHttpResponse> handleUpdate(
             RestApiHttpRequest req,
             RestApiHttpResponse res,
             ConfigurationPresentation<String> presentation
     ) {
-        try {
-            String updateReq = req
-                    .request()
-                    .content()
-                    .readCharSequence(req.request().content().readableBytes(), UTF_8)
-                    .toString();
-
-            presentation.update(updateReq);
-        } catch (IllegalArgumentException e) {
-            ErrorResult errRes = new ErrorResult("INVALID_CONFIG_FORMAT", e.getMessage());
-
-            res.status(BAD_REQUEST);
-            res.json(Map.of("error", errRes));
-        } catch (ConfigurationValidationException e) {
-            ErrorResult errRes = new ErrorResult("VALIDATION_EXCEPTION", e.getMessage());
-
-            res.status(BAD_REQUEST);
-            res.json(Map.of("error", errRes));
-        } catch (IgniteException e) {
-            ErrorResult errRes = new ErrorResult("APPLICATION_EXCEPTION", e.getMessage());
-
-            res.status(BAD_REQUEST);
-            res.json(Map.of("error", errRes));
-        }
+        String updateReq = req
+                .request()
+                .content()
+                .readCharSequence(req.request().content().readableBytes(), UTF_8)
+                .toString();
+
+        return presentation.update(updateReq)
+                .thenApply(v -> res)

Review comment:
       We will return an empty response




-- 
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-unsubscribe@ignite.apache.org

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