EA-213309: Eliminate "Invalid method id" exception
This commit is contained in:
+11
-3
@@ -68,15 +68,15 @@ fun StackFrameProxy.safeStackFrame(): StackFrame? {
|
||||
}
|
||||
|
||||
fun Location.safeSourceName(): String? {
|
||||
return wrapAbsentInformationException { this.sourceName() }
|
||||
return wrapIllegalArgumentException { wrapAbsentInformationException { this.sourceName() } }
|
||||
}
|
||||
|
||||
fun Location.safeSourceName(stratum: String): String? {
|
||||
return wrapAbsentInformationException { this.sourceName(stratum) }
|
||||
return wrapIllegalArgumentException { wrapAbsentInformationException { this.sourceName(stratum) } }
|
||||
}
|
||||
|
||||
fun Location.safeLineNumber(): Int {
|
||||
return DebuggerUtilsEx.getLineNumber(this, false)
|
||||
return wrapIllegalArgumentException { DebuggerUtilsEx.getLineNumber(this, false) } ?: -1
|
||||
}
|
||||
|
||||
fun Location.safeLineNumber(stratum: String): Int {
|
||||
@@ -118,6 +118,14 @@ private inline fun <T> wrapEvaluateException(block: () -> T): T? {
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <T> wrapIllegalArgumentException(block: () -> T): T? {
|
||||
return try {
|
||||
block()
|
||||
} catch (e: IllegalArgumentException) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <T> wrapAbsentInformationException(block: () -> T): T? {
|
||||
return try {
|
||||
block()
|
||||
|
||||
Reference in New Issue
Block a user