Skip to content

Commit 9e3b304

Browse files
committed
Mitigate spray.json.JsonParser$ParsingException: Unexpected end-of-input at PersistenceSchemaWriter
1 parent 53846ab commit 9e3b304

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dump-persistence-schema-compiler-plugin/src/main/scala/org/virtuslab/ash/writer/PersistenceSchemaWriter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.virtuslab.ash.writer
22

33
import scala.collection.mutable
4+
import scala.util.Try
45

56
import better.files.File
67
import spray.json._
@@ -18,7 +19,7 @@ class PersistenceSchemaWriter(outputDirectory: File) extends DumpPersistenceSche
1819
outputDirectory
1920
.createDirectoryIfNotExists(createParents = true)
2021
.list(_.extension.contains(".json"))
21-
.map(_.contentAsString.parseJson.convertTo[TypeDefinition])
22+
.flatMap(file => Try(file.contentAsString.parseJson.convertTo[TypeDefinition]).toOption)
2223
.map(x => (x.name, x))
2324
.toMap
2425
}

0 commit comments

Comments
 (0)