takahirom/roborazzi

git lfs - Potential for better error messaging?

Open

#503 opened on Oct 10, 2024

 (2 comments) (0 reactions) (0 assignees)Kotlin (52 forks)github user discovery
contributions welcomehacktoberfest

Repository metrics

Stars
 (957 stars)
PR merge metrics
 (Avg merge 9h 31m) (29 merged PRs in 30d)

Description

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."
}

Contributor guide