** (Jason.DecodeError) unexpected end of input at position 0

This error cropped up after successfully polling an API nine times. What is it trying to communicate? Why did it come up after so many successful polls? How do I remedy this issue?

Thanks for tackling these questions :slight_smile:

I think the API returned invalid json, probably an empty string in this case

Interesting! Looks like a Genserver with robust error-handling is in order. Or is there a better approach?

Thanks again for being so helpful! :slight_smile:

I think it will be hard fo us to give you more guidance without knowing more about the problem you are trying to solve.

1 Like

Well, right now this error just crashes the entire application. So what I need is for it to be able to automatically re-poll the API after an error like this comes up, makes sense?

How are you running your application? Is this polling process part of a application supervision tree?

It’s still in development so I’ve been using IEX to test its components.


Then I think you should start to look into OTP applications and supervisors, it can feel a bit daunting at first but it is well invested time :slight_smile:

You are very likely receiving an empty string from that API. Without any details given, we can’t help more than that.

Excellent, will do! If you’ve got any resources for noobs they’d be greatly appreciated :slight_smile:

Thanks again! :slight_smile: