Skip to content

Commit

Permalink
refactor(network): 优化HTTP请求处理和异常捕获
Browse files Browse the repository at this point in the history
- 修复ShireMarketplaceTableView中变量声明不一致问题
- 在ShireRunner中添加对detachProcess异常的处理
  • Loading branch information
phodal committed Sep 19, 2024
1 parent 63f4c3b commit bd7d233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ class ShireRunner(
val processor2 = hobbitHole?.executeAfterStreamingProcessor(project, console, context)
PostProcessorContext.updateOutput(processor2)

processHandler.detachProcess()
try {
processHandler.detachProcess()
} catch (e: Exception) {
// console?.print(e.message ?: "Error", ConsoleViewContentType.ERROR_OUTPUT)
}
}

private fun printCompiledOutput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ class ShireMarketplaceTableView(val project: Project) {
val objectMapper = ObjectMapper()

val request = Request.Builder().url(SHIRE_MKT_HOST).get().build()
var responses: Response = client.newCall(request).execute()

val responses: Response = client.newCall(request).execute()
val jsonData = responses.body?.string()
val packages = objectMapper.readValue(jsonData, Array<ShirePackage>::class.java)
return packages.toList()
Expand Down

0 comments on commit bd7d233

Please sign in to comment.