Skip to content

Commit

Permalink
Handle exceptions when Packwerk cannot be executed
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-vinted committed Jul 3, 2023
1 parent 7ef91b0 commit 341ea12
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vinted.packwerkintellij.annotators

import com.intellij.execution.ExecutionException
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.lang.annotation.ExternalAnnotator
Expand Down Expand Up @@ -59,7 +60,14 @@ internal class PackwerkAnnotator : ExternalAnnotator<PackwerkAnnotator.State, Pa
.withCharset(Charset.forName("UTF-8"))
.withParameters("check", relativePath)

val process = cmd.createProcess()
val process: Process
try {
process = cmd.createProcess()
} catch (e: ExecutionException) {
thisLogger().debug("Not linting because Packwerk could not be executed", e)
return null
}

val scanner = Scanner(process.inputStream)
val problems = ArrayList<Problem>()

Expand Down

0 comments on commit 341ea12

Please sign in to comment.