adoroszlai commented on code in PR #10097:
URL: https://github.com/apache/ozone/pull/10097#discussion_r3115726357
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/exception/OS3Exception.java:
##########
@@ -66,31 +66,16 @@ public OS3Exception() {
//Added for JaxB.
}
- /**
- * Create an object OS3Exception.
- * @param codeVal
- * @param messageVal
- * @param requestIdVal
- * @param resourceVal
- */
- public OS3Exception(String codeVal, String messageVal, String requestIdVal,
- String resourceVal) {
- this.code = codeVal;
- this.errorMessage = messageVal;
- this.requestId = requestIdVal;
- this.resource = resourceVal;
- }
+ OS3Exception(S3ErrorTable error, Exception cause, String resource) {
+ super(error.getErrorMessage(), cause);
- /**
- * Create an object OS3Exception.
- * @param codeVal
- * @param messageVal
- * @param httpCode
- */
- public OS3Exception(String codeVal, String messageVal, int httpCode) {
- this.code = codeVal;
- this.errorMessage = messageVal;
- this.httpCode = httpCode;
+ code = error.getCode();
+ errorMessage = error.getErrorMessage();
+ httpCode = error.getHttpCode();
+ this.resource = resource;
+
+ // logging in S3ErrorTable to respect any existing log level setting
+ S3ErrorTable.log(this);
Review Comment:
Using a factory method brings back the original problem, stack trace would
have "factory" and `newError` in first two levels.
We can move `log()` call to `newError`, which increases code duplication a
bit.
Or we can increase stack trace elements from 3 to 4 in log config, which
increases duplication in audit log:
https://github.com/apache/ozone/blob/0039ce6ea39287b4932945c15f268b7628d4dcea/hadoop-ozone/dist/src/shell/conf/s3g-audit-log4j2.properties#L76
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]