Add detailed exception prompt

This commit is contained in:
Him188 2020-02-28 08:56:47 +08:00
parent 197bf2e2dd
commit 32b1decd0d

View File

@ -65,7 +65,7 @@ fun File.toExternalImage(): ExternalImage {
val input = ImageIO.createImageInputStream(this) val input = ImageIO.createImageInputStream(this)
checkNotNull(input) { "Unable to read file(path=${this.path}), no ImageInputStream found" } checkNotNull(input) { "Unable to read file(path=${this.path}), no ImageInputStream found" }
val image = ImageIO.getImageReaders(input).asSequence().firstOrNull() val image = ImageIO.getImageReaders(input).asSequence().firstOrNull()
?: error("Unable to read file(path=${this.path}), no ImageReader found") ?: error("Unable to read file(path=${this.path}), no ImageReader found (file type not supported)")
image.input = input image.input = input
return ExternalImage( return ExternalImage(