Skip to content

DRMCDU-1548: add into details exception data. update version to 0.0.4#22

Merged
rb-us-uf merged 2 commits intomainfrom
DRMCDU-1548
Feb 13, 2026
Merged

DRMCDU-1548: add into details exception data. update version to 0.0.4#22
rb-us-uf merged 2 commits intomainfrom
DRMCDU-1548

Conversation

@rb-us-uf
Copy link
Collaborator

No description provided.

}
val exception = root().exceptionOrNull()
if (exception != null) {
allDetails.add(Details.Item(key = EXCEPTION_CAUSE, value = exception.cause.toString()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я не впевнений та мабуть надо чекати що cause != null бо виклик toString() може викинути NPE + Цікаво, як воно форматне реальний cause ексепшен? Якщо я не помиляюсь cause має тип Throwable і в нього всередині має бути вкладений cause і так далі (з цього також роблю висновок що cause може бути null). Можливо варто його рекурсивно обійти і розкласти в структуру якусь

Copy link
Collaborator

Choose a reason for hiding this comment

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

UPD: от шо я маю на увазі в коді

Suggested change
allDetails.add(Details.Item(key = EXCEPTION_CAUSE, value = exception.cause.toString()))
public fun traverseThrowable(th: Throwable): List<Pair<String, String>> {
var current: Throwable? = th
val details = mutableListOf<Pair<String, String>>()
while (current != null) {
Pair("exception-message", current.message)
Pair("stacktrace", current.stackTraceToString())
current = current.cause
}
return details
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Стектрейс можна один раз додати а всі вкладені ексепшени пройти отаким чином. Це приклад коду не зовсім коректний але ідею саму пояснює

Copy link
Collaborator

Choose a reason for hiding this comment

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

Та по ідеї cause як мінімум а може і message не потрібні.

Printing the Chain: The stackTraceToString() function provides a detailed description of the exception, including the message, stack trace, and the detailed descriptions of each throwable in the cause chain.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Типу cause використовується всередині Throwable для лінкування. Але для виведення інформації вже є готова функція stackTraceToString()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Є тест який покриває кейс коли exception.cause == null і він повертає: exception-cause=null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Я додав cause та message щоб коли ти починаєш читати можна було лаконічно побачити причину інциденту але якщо не зрозуміло , то вже є exception.stackTraceToString(). В теорії їх можна видалити бо ця інфа дійсно є в exception.stackTraceToString()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Якщо в кожному вкладенні робити ось так current.stackTraceToString(), то получимо дуже багато дубльованого тексту

Copy link
Collaborator

@MaksymFishyn MaksymFishyn left a comment

Choose a reason for hiding this comment

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

є пропозиції

}
val exception = root().exceptionOrNull()
if (exception != null) {
allDetails.add(Details.Item(key = EXCEPTION_CAUSE, value = exception.cause.toString()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

UPD: от шо я маю на увазі в коді

Suggested change
allDetails.add(Details.Item(key = EXCEPTION_CAUSE, value = exception.cause.toString()))
public fun traverseThrowable(th: Throwable): List<Pair<String, String>> {
var current: Throwable? = th
val details = mutableListOf<Pair<String, String>>()
while (current != null) {
Pair("exception-message", current.message)
Pair("stacktrace", current.stackTraceToString())
current = current.cause
}
return details
}

Copy link
Collaborator

@MaksymFishyn MaksymFishyn left a comment

Choose a reason for hiding this comment

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

Я б залишив як є, але додавав би в дітейлз тільки інформацію stackTraceToString

@rb-us-uf rb-us-uf merged commit a1aebc4 into main Feb 13, 2026
1 check failed
@rb-us-uf rb-us-uf deleted the DRMCDU-1548 branch February 17, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants