INTERNAL: stacktrace all exceptions#840
Merged
jhpark816 merged 1 commit intonaver:developfrom Nov 25, 2024
Merged
Conversation
Collaborator
|
아래와 같이 단순하게 하면 어떻게 되나요? @Override
public synchronized Throwable getCause() {
return !exceptions.isEmpty() ? exceptions.get(0) : null;
}
@Override
public StackTraceElement[] getStackTrace() {
return exceptions.stream()
.map(Throwable::getStackTrace)
.flatMap(Arrays::stream)
.toArray(StackTraceElement[]::new);
}
@Override
public void printStackTrace(PrintStream s) {
exceptions.forEach((e) -> e.printStackTrace(s));
}
@Override
public void printStackTrace(PrintWriter s) {
exceptions.forEach((e) -> e.printStackTrace(s));
} |
Collaborator
|
@oliviarla |
Collaborator
Author
|
@uhm0311 기존에는 내부에 담긴 Exception들의 스택트레이스가 없이 CompositeException 자체의 스택트레이스만 반환되었습니다. |
uhm0311
requested changes
Nov 21, 2024
uhm0311
reviewed
Nov 21, 2024
src/main/java/net/spy/memcached/internal/CompositeException.java
Outdated
Show resolved
Hide resolved
0b102a0 to
cce2682
Compare
uhm0311
requested changes
Nov 21, 2024
| exceptions.add(new OperationException(OperationErrorType.SERVER, "msg1")); | ||
| exceptions.add(new OperationException(OperationErrorType.CLIENT, "msg2")); | ||
|
|
||
| logger.error("failed to get", new CompositeException(exceptions)); |
Collaborator
There was a problem hiding this comment.
이 로거는 자바 클라이언트 내부에 구현된 로거를 사용할 것입니다.
log4j 의존성은 이미 포함되어 있으니 log4j의 로거도 한 번 사용해봅시다.
Collaborator
Author
There was a problem hiding this comment.
log4j 사용하는 테스트도 추가했습니다.
Comment on lines
18
to
20
| super(ExceptionMessageFactory.createCompositeMessage(exceptions)); | ||
| if (exceptions.size() > 1) { |
Collaborator
Author
There was a problem hiding this comment.
empty line 같은 경우에는 정해져있는 룰이 있었나요?
가독성 좋아보이게 제 나름대로 수정해두었습니다.
uhm0311
approved these changes
Nov 21, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
⌨️ What I did