Skip to content

Commit

Permalink
✨ Add more info for exception present (#484)
Browse files Browse the repository at this point in the history
* ✨ Add more info for exception present

* 🚨 Make ktlint happy
  • Loading branch information
devkanro authored Feb 2, 2023
1 parent 1ad992f commit fa67ca5
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ operator fun Status.Companion.invoke(exception: Throwable): Status {
code = exception.status.code.value()
exception.status.description?.let { message = it }
}

is StatusRuntimeException -> Status {
code = exception.status.code.value()
exception.status.description?.let { message = it }
}

is com.bybutter.sisyphus.rpc.StatusException -> Status {
code = exception.code
exception.message?.let { message = it }
}

is ClientStatusException -> exception.status
else -> Status {
code = Code.INTERNAL.number
Expand Down Expand Up @@ -109,7 +112,7 @@ operator fun ResourceInfo.Companion.invoke(
resourceType: String,
resourceName: String,
description: String,
owner: String = ""
owner: String = "",
): ResourceInfo {
return ResourceInfo {
this.resourceType = resourceType
Expand Down Expand Up @@ -161,9 +164,9 @@ operator fun RetryInfo.Companion.invoke(number: Long, unit: TimeUnit = TimeUnit.

operator fun DebugInfo.Companion.invoke(exception: Throwable): DebugInfo {
return DebugInfo {
exception.message?.let { this.detail = it }
this.stackEntries += exception.stackTrace.map {
it.toString()
this.detail = exception.toString()
exception.stackTrace.forEach {
this.stackEntries += it.toString()
}
}
}

0 comments on commit fa67ca5

Please sign in to comment.