From 276822305488618c59673e166f09222211641738 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 14 May 2021 22:39:30 +0200 Subject: [PATCH 1/2] Update cats-parse to 0.3.4 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index dfe26cde..76d5d0f9 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,7 +9,7 @@ object Dependencies { val BetterMonadicForVersion = "0.3.1" val BitpeaceVersion = "0.8.0" val CalevVersion = "0.4.3" - val CatsParseVersion = "0.3.2" + val CatsParseVersion = "0.3.4" val CirceVersion = "0.13.0" val ClipboardJsVersion = "2.0.6" val DoobieVersion = "0.13.2" From 283e80bc47835c0927bb47267fad696f81cd81da Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Sun, 16 May 2021 22:49:20 +0200 Subject: [PATCH 2/2] Add a now missing case to handle parse failures --- .../shared/src/main/scala/docspell/query/ParseFailure.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/query/shared/src/main/scala/docspell/query/ParseFailure.scala b/modules/query/shared/src/main/scala/docspell/query/ParseFailure.scala index 128a08c4..2ecb1edf 100644 --- a/modules/query/shared/src/main/scala/docspell/query/ParseFailure.scala +++ b/modules/query/shared/src/main/scala/docspell/query/ParseFailure.scala @@ -10,6 +10,7 @@ import cats.parse.Parser.Expectation.InRange import cats.parse.Parser.Expectation.Length import cats.parse.Parser.Expectation.OneOfStr import cats.parse.Parser.Expectation.StartOfString +import cats.parse.Parser.Expectation.WithContext final case class ParseFailure( input: String, @@ -101,5 +102,8 @@ object ParseFailure { case OneOfStr(offset, strs) => val options = strs.take(8) ExpectMessage(offset, options.take(7), options.size < 8) + + case WithContext(ctx, expect) => + ExpectMessage(expect.offset, s"Failed to parse near: $ctx" :: Nil, true) } }