Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add context to json paring errors #1373

Merged
merged 1 commit into from Mar 25, 2020

Conversation

@ingarabr
Copy link
Contributor

ingarabr commented Mar 25, 2020

Wraps decoding errors into a case calls including uri and method. It makes it possible to identify the origin of the error.

The error I got on my CI server:

org.http4s.MalformedMessageBodyFailure: Malformed message body: Invalid JSON: empty body
	at org.http4s.jawn.JawnInstances$.defaultJawnEmptyBodyMessage(JawnInstances.scala:42)
	at org.http4s.jawn.JawnInstances.jawnEmptyBodyMessage(JawnInstances.scala:17)
	at org.http4s.jawn.JawnInstances.jawnEmptyBodyMessage$(JawnInstances.scala:16)
	at org.http4s.circe.package$.jawnEmptyBodyMessage(package.scala:3)
	at org.http4s.circe.CirceInstances.$anonfun$jsonDecoderByteBufferImpl$1(CirceInstances.scala:41)
	at scala.util.Either.flatMap(Either.scala:352)
	at cats.data.EitherT.$anonfun$subflatMap$1(EitherT.scala:365)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.effect.IO$Map.apply(IO.scala:1504)
	at cats.effect.IO$Map.apply(IO.scala:1502)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:142)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:359)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:380)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:323)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:139)
	at cats.effect.internals.IORunLoop$.startCancelable(IORunLoop.scala:41)
	at cats.effect.internals.IOBracket$BracketStart.run(IOBracket.scala:88)
	at cats.effect.internals.Trampoline.cats$effect$internals$Trampoline$$immediateLoop(Trampoline.scala:67)
	at cats.effect.internals.Trampoline.startLoop(Trampoline.scala:35)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.super$startLoop(TrampolineEC.scala:89)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.$anonfun$startLoop$1(TrampolineEC.scala:89)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.startLoop(TrampolineEC.scala:89)
	at cats.effect.internals.Trampoline.execute(Trampoline.scala:43)
	at cats.effect.internals.TrampolineEC.execute(TrampolineEC.scala:42)
	at cats.effect.internals.Callback$AsyncIdempotentCallback.apply(Callback.scala:136)
	at cats.effect.internals.Callback$AsyncIdempotentCallback.apply(Callback.scala:125)
	at org.http4s.client.asynchttpclient.AsyncHttpClient$$anon$1.$anonfun$onCompleted$1(AsyncHttpClient.scala:126)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:359)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:380)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:323)
	at cats.effect.internals.IOShift$Tick.run(IOShift.scala:35)
	at cats.effect.internals.PoolUtils$$anon$2$$anon$3.run(PoolUtils.scala:52)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Wraps decoding errors into a case calls including uri and method. Makes
it possible to identify the origin of the error.
@codecov

This comment has been minimized.

Copy link

codecov bot commented Mar 25, 2020

Codecov Report

Merging #1373 into master will decrease coverage by 0.09%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1373      +/-   ##
==========================================
- Coverage   70.72%   70.63%   -0.10%     
==========================================
  Files         102      102              
  Lines        1561     1563       +2     
  Branches       52       53       +1     
==========================================
  Hits         1104     1104              
- Misses        457      459       +2     
Impacted Files Coverage Δ
...la/org/scalasteward/core/util/HttpJsonClient.scala 50.00% <33.33%> (-12.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4df9c0...40fd2fa. Read the comment docs.

Copy link
Owner

fthomas left a comment

LGTM, many thanks @ingarabr!

@fthomas fthomas added this to the 0.6.0 milestone Mar 25, 2020
@fthomas fthomas added the enhancement label Mar 25, 2020
@fthomas fthomas merged commit 77925ac into fthomas:master Mar 25, 2020
2 of 5 checks passed
2 of 5 checks passed
Codacy/PR Quality Review Not up to standards. This pull request quality could be better.
Details
codecov/patch 33.33% of diff hit (target 70.72%)
Details
codecov/project 70.63% (+-0.10%) compared to b4df9c0
Details
Summary no rules match, no planned actions
Details
Travis CI - Pull Request Build Passed
Details
@ingarabr

This comment has been minimized.

Copy link
Contributor Author

ingarabr commented Mar 26, 2020

@fthomas , I'm happy to help out. Thanks for all the work you have put into it. :)

@ingarabr ingarabr deleted the ingarabr:feature/http-client-debug-info branch Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.