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")
|
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 bintrayRepo by extra("dataforge")
|
||||||
val githubProject by extra("dataforge-core")
|
val githubProject by extra("dataforge-core")
|
||||||
|
@ -152,8 +152,8 @@ public fun IOPlugin.readEnvelopeFile(
|
|||||||
path: Path,
|
path: Path,
|
||||||
readNonEnvelopes: Boolean = false,
|
readNonEnvelopes: Boolean = false,
|
||||||
formatPicker: IOPlugin.(Path) -> EnvelopeFormat? = IOPlugin::peekFileEnvelopeFormat,
|
formatPicker: IOPlugin.(Path) -> EnvelopeFormat? = IOPlugin::peekFileEnvelopeFormat,
|
||||||
): Envelope? {
|
): Envelope {
|
||||||
if (!Files.exists(path)) return null
|
if (!Files.exists(path)) error("File with path $path does not exist")
|
||||||
|
|
||||||
//read two-files directory
|
//read two-files directory
|
||||||
if (Files.isDirectory(path)) {
|
if (Files.isDirectory(path)) {
|
||||||
@ -182,7 +182,7 @@ public fun IOPlugin.readEnvelopeFile(
|
|||||||
path.readEnvelope(format)
|
path.readEnvelope(format)
|
||||||
} ?: if (readNonEnvelopes) { // if no format accepts file, read it as binary
|
} ?: if (readNonEnvelopes) { // if no format accepts file, read it as binary
|
||||||
SimpleEnvelope(Meta.EMPTY, path.asBinary())
|
SimpleEnvelope(Meta.EMPTY, path.asBinary())
|
||||||
} else null
|
} else error("Can't infer format for file $path")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user