This is an automated email from the ASF dual-hosted git repository.

xhsun pushed a commit to branch show_messages_as_error
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 6e3abcef8d1ec4b2484873500020b1d0cf632152
Author: Xiaohui Sun <[email protected]>
AuthorDate: Mon Apr 6 11:27:40 2020 -0700

    [TE] Show error messages to the new UI
---
 .../apache/pinot/thirdeye/detection/yaml/YamlResource.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
index 3b40ebe..ad41258 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
@@ -249,15 +249,15 @@ public class YamlResource {
   private Response processServerErrorResponse(String type, String operation, 
String payload, Exception e) {
     Map<String, String> responseMessage = new HashMap<>();
     LOG.error("Error {} {} with payload {}", operation, type, payload, e);
-    responseMessage.put("message", "Failed to create the " + type + ". Reach 
out to the ThirdEye team.");
+    responseMessage.put("error", "Failed to create the " + type);
     responseMessage.put("more-info", "Error = " + e.getMessage());
     return Response.serverError().entity(responseMessage).build();
   }
 
   private Response processBadAuthorizationResponse(String type, String 
operation, String payload, NotAuthorizedException e) {
     Map<String, String> responseMessage = new HashMap<>();
-    LOG.warn("Authorization error while {} {} with payload {}", operation, 
type, payload, e);
-    responseMessage.put("message", "Authorization error! You do not have 
permissions to " + operation + " this " + type + " config");
+    LOG.error("Authorization error while {} {} with payload {}", operation, 
type, payload, e);
+    responseMessage.put("error", "Authorization error! You do not have 
permissions to " + operation + " this " + type + " config");
     responseMessage.put("more-info", "Configure owners property in " + type + 
" config");
     return 
Response.status(Response.Status.UNAUTHORIZED).entity(responseMessage).build();
   }
@@ -857,7 +857,8 @@ public class YamlResource {
       StringBuilder sb = new StringBuilder();
       // show more stack message to frontend for debugging
       getErrorMessage(0, 5, e, sb);
-      responseMessage.put("message", "Failed to run the preview. Error stack: 
" + sb.toString());
+      responseMessage.put("error", "Failed to run the preview.");
+      responseMessage.put("more-info", "Error stack " + sb.toString());
       return Response.serverError().entity(responseMessage).build();
     } finally {
       // stop the preview
@@ -1089,7 +1090,7 @@ public class YamlResource {
       yamls = queryDetectionConfigurations(dataset, metric);
     } catch (Exception e) {
       LOG.warn("Error while fetching detection yaml configs.", e.getMessage());
-      responseMessage.put("message", "Failed to fetch all the detection 
configurations.");
+      responseMessage.put("error", "Failed to fetch all the detection 
configurations.");
       responseMessage.put("more-info", "Error = " + e.getMessage());
       return Response.serverError().entity(responseMessage).build();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to