readEnvelopeFile throws exception instead of returning null for missing encoders
This commit is contained in:
parent
25cba0c6de
commit
e88178ffe7
@ -2,7 +2,7 @@ plugins {
|
||||
id("ru.mipt.npm.project")
|
||||
}
|
||||
|
||||
val dataforgeVersion by extra("0.3.0-dev-1")
|
||||
val dataforgeVersion by extra("0.3.0-dev-2")
|
||||
|
||||
val bintrayRepo by extra("dataforge")
|
||||
val githubProject by extra("dataforge-core")
|
||||
|
@ -152,8 +152,8 @@ public fun IOPlugin.readEnvelopeFile(
|
||||
path: Path,
|
||||
readNonEnvelopes: Boolean = false,
|
||||
formatPicker: IOPlugin.(Path) -> EnvelopeFormat? = IOPlugin::peekFileEnvelopeFormat,
|
||||
): Envelope? {
|
||||
if (!Files.exists(path)) return null
|
||||
): Envelope {
|
||||
if (!Files.exists(path)) error("File with path $path does not exist")
|
||||
|
||||
//read two-files directory
|
||||
if (Files.isDirectory(path)) {
|
||||
@ -182,7 +182,7 @@ public fun IOPlugin.readEnvelopeFile(
|
||||
path.readEnvelope(format)
|
||||
} ?: if (readNonEnvelopes) { // if no format accepts file, read it as binary
|
||||
SimpleEnvelope(Meta.EMPTY, path.asBinary())
|
||||
} else null
|
||||
} else error("Can't infer format for file $path")
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user