takahirom/roborazzi

git lfs - Potential for better error messaging?

Aperta

#503 aperta il 10 ott 2024

 (2 commenti) (0 reazioni) (0 assegnatari)Kotlin (52 fork)github user discovery
contributions welcomehacktoberfest

Metriche repository

Star
 (957 stelle)
Metriche merge PR
 (Merge medio 9h 31m) (29 PR mergiate in 30 g)

Descrizione

While working through migrating some jobs from circle CI over to GHA I hit an error in the test run due to git-lfs not being setup correctly on our self hosted runners.

Stack of the error looks like this:

java.lang.NullPointerException: read(...) must not be null
at com.github.takahirom.roborazzi.AwtRoboCanvas$Companion.load(AwtRoboCanvas.kt:312)
at com.github.takahirom.roborazzi.RoborazziKt.processOutputImageAndReportWithDefaults$lambda$21(Roborazzi.kt:647)
at com.github.takahirom.roborazzi.ProcessOutputImageAndReportKt.processOutputImageAndReport(processOutputImageAndReport.kt:79)
at com.github.takahirom.roborazzi.RoborazziKt.processOutputImageAndReportWithDefaults(Roborazzi.kt:634)
at com.github.takahirom.roborazzi.RoborazziKt$captureScreenRoboImage$3.invoke(Roborazzi.kt:158)
at com.github.takahirom.roborazzi.RoborazziKt$captureScreenRoboImage$3.invoke(Roborazzi.kt:151)
at com.github.takahirom.roborazzi.RoborazziKt.capture(Roborazzi.kt:614)
at com.github.takahirom.roborazzi.RoborazziKt.captureScreenRoboImage(Roborazzi.kt:151) 
at com.github.takahirom.roborazzi.RoborazziKt.captureScreenRoboImage(Roborazzi.kt:123)
at com.github.takahirom.roborazzi.RoborazziKt.captureScreenRoboImage$default(Roborazzi.kt:118)

https://github.com/takahirom/roborazzi/blob/828760f94d77be152e6ed12b68263d5bf0cc6463/roborazzi-painter/src/commonJvmMain/kotlin/com/github/takahirom/roborazzi/AwtRoboCanvas.kt#L312

that line could be augmented pretty easily to provide some extra information something like this?

val loadedImage: BufferedImage = requireNotNull(ImageIO.read(file)) {
  "Failed to read file: ${file.path}. If you are using git-lfs ensure it has been setup correctly on this host."
}

Guida contributor