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

Requesting a single thread throws JsonEncodingException #248

Open
flokle opened this issue Oct 3, 2024 · 0 comments
Open

Requesting a single thread throws JsonEncodingException #248

flokle opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@flokle
Copy link

flokle commented Oct 3, 2024

I have tried to fetch a single thread via the sdk. The following error is thrown:

com.squareup.moshi.JsonEncodingException: Use JsonReader.setLenient(true) to accept malformed JSON at path $
	at com.squareup.moshi.JsonReader.syntaxError(JsonReader.java:243)
	at com.squareup.moshi.JsonUtf8Reader.checkLenient(JsonUtf8Reader.java:1154)
	at com.squareup.moshi.JsonUtf8Reader.doPeek(JsonUtf8Reader.java:386)
	at com.squareup.moshi.JsonUtf8Reader.peek(JsonUtf8Reader.java:208)
	at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:38)
	at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:58)
	at com.nylas.NylasClient.executeRequest(NylasClient.kt:330)
	at com.nylas.NylasClient.executeGet(NylasClient.kt:175)
	at com.nylas.resources.Resource.findResource(Resource.kt:27)
	at com.nylas.resources.Resource.findResource$default(Resource.kt:26)
	at com.nylas.resources.Threads.find(Threads.kt:33)
	at com.nylas.resources.Threads.find$default(Threads.kt:31)
	at com.nylas.resources.Threads.find(Threads.kt)

So i fetched the same thread via Postman and got this result:

Status code: 404
Body:
{
    "request_id": "...",
    "error": {
        "type": "not_found_error",
        "message": "no messages found in this thread"
    }
}

What makes me wonder is that I have seen this error message in a NylasApiError exception before. I wonder why this JsonEncodingException is thrown here.

Expected behavior
There is always the same behavior in such a case - A NylasApiError is thrown with the message: "no messages found in this thread"

SDK Version:
2.5.0

@flokle flokle added the bug Something isn't working label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant