Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) {
response.getWriter().println("{\"brokerage\": " + value + "}");
} catch (DecoderException | IllegalArgumentException e) {
try {
response.getWriter().println("{\"Error\": " + "\"INVALID address\"}");
response.getWriter()
.println("{\"Error\": " + "\"INVALID address, " + e.getMessage() + "\"}");
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) {
response.getWriter().println("{\"reward\": " + value + "}");
} catch (DecoderException | IllegalArgumentException e) {
try {
response.getWriter().println("{\"Error\": " + "\"INVALID address\"}");
response.getWriter()
.println("{\"Error\": " + "\"INVALID address, " + e.getMessage() + "\"}");
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) {
String input = request.getParameter("value");
fillResponse(ByteString.copyFrom(ByteArray.fromHexString(input)), visible, response);
} catch (Exception e) {
Util.processError(e, response);
logger.debug("Exception: {}", e.getMessage());
try {
response.getWriter().println(e.getMessage());
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
}
}

Expand All @@ -41,7 +46,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
JsonFormat.merge(params.getParams(), build, params.isVisible());
fillResponse(build.build().getValue(), params.isVisible(), response);
} catch (Exception e) {
Util.processError(e, response);
logger.debug("Exception: {}", e.getMessage());
try {
response.getWriter().println(e.getMessage());
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's not a good idea to modify the error message and remove Exception for every API. A better solution would be to update the implementation of Util.processError uniformly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@317787106 This is a legacy API; do not modify anything, even the error messages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.tron.core.services.http.solidity;

import com.google.protobuf.ByteString;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -36,7 +37,12 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) {
response.getWriter().println(JsonFormat.printToString(transInfo, visible));
}
} catch (Exception e) {
Util.processError(e, response);
logger.debug("Exception: {}", e.getMessage());
try {
response.getWriter().println(e.getMessage());
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
}
}

Expand All @@ -54,7 +60,12 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
response.getWriter().println(JsonFormat.printToString(transInfo, params.isVisible()));
}
} catch (Exception e) {
Util.processError(e, response);
logger.debug("Exception: {}", e.getMessage());
try {
response.getWriter().println(e.getMessage());
} catch (IOException ioe) {
logger.debug("IOException: {}", ioe.getMessage());
}
}
}

Expand Down