Skip to content

Commit

Permalink
Wrap in try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Mar 26, 2024
1 parent d064000 commit 3f76df5
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ private[debug] final case class ClientConfigurationAdapter(
*/
def adaptStackTraceResponse(result: JsonObject): JsonObject = {
if (clientId.contains("vscode")) {
// For VSCode only, we hack the json result of the stack trace response
// to replace all occurrences of 'subtle' by 'deemphasize'.
val frames = result.get("stackFrames").getAsJsonArray()
for (i <- 0.until(frames.size)) {
val frame = frames.get(i).getAsJsonObject()
val presentationHint = Option(frame.get("presentationHint"))
.map(_.getAsJsonPrimitive.getAsString)
if (presentationHint.contains("subtle")) {
frame.add("presentationHint", new JsonPrimitive("deemphasize"))
try {
// For VSCode only, we hack the json result of the stack trace response
// to replace all occurrences of 'subtle' by 'deemphasize'.
val frames = result.get("stackFrames").getAsJsonArray()
for (i <- 0.until(frames.size)) {
val frame = frames.get(i).getAsJsonObject()
val presentationHint = Option(frame.get("presentationHint"))
.map(_.getAsJsonPrimitive.getAsString)
if (presentationHint.contains("subtle")) {
frame.add("presentationHint", new JsonPrimitive("deemphasize"))
}
}
} catch {
case _: IllegalStateException => ()
}
}
result
Expand Down

0 comments on commit 3f76df5

Please sign in to comment.