Skip to content

Commit

Permalink
Minor improvement for SQLStore.toJson
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Aug 25, 2024
1 parent c909712 commit 16e08f0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sql/src/main/scala/lightdb/sql/SQLStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,11 @@ abstract class SQLStore[Doc <: Document[Doc], Model <: DocumentModel[Doc]] exten
case DefType.Str => str(s)
case DefType.Opt(DefType.Str) => str(s)
case DefType.Json => JsonParser(s)
case DefType.Obj(_, _) | DefType.Arr(_) | DefType.Opt(DefType.Obj(_, _)) => try {
case _ => try {
JsonParser(s)
} catch {
case t: Throwable => throw new RuntimeException(s"Unable to parse: [$s] as JSON for ${rw.definition}", t)
}
case d => throw new UnsupportedOperationException(s"Unsupported definition: $d for $s")
}
case b: Boolean => bool(b)
case i: Int => num(i)
Expand Down

0 comments on commit 16e08f0

Please sign in to comment.