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

jrpc - make cleaner error message #633

Closed
wiardvanrij opened this issue Oct 24, 2022 · 2 comments · Fixed by #634
Closed

jrpc - make cleaner error message #633

wiardvanrij opened this issue Oct 24, 2022 · 2 comments · Fixed by #634

Comments

@wiardvanrij
Copy link
Collaborator

I had the following error:

2022/10/24 16:21:15 deserialization error, code 404: invalid character '<' looking for beginning of value (raw reply: 54712: <!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"/><meta...4327a12b80cac28c34f.js\"></script><script nonce=\"\">performance.mark('frontend_boot_js_done_time_seconds');</script></body></html>)
exit status 1

This was due to a bug on my end (wrong path to request). Yet I found the error confusing and it took me a while to get it. What would make it more clear/easier is a format like:

2022/10/24 16:21:15 deserialization error: invalid character '<' looking for beginning of value 
2022/10/24 16:21:15 request: HTTP code 404
2022/10/24 16:21:15 raw reply: 54712: <!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"/><meta...4327a12b80cac28c34f.js\"></script><script nonce=\"\">performance.mark('frontend_boot_js_done_time_seconds');</script></body></html>
exit status 1
@ldemailly
Copy link
Member

Can you say what you actually called? because in theory a 404 is intercepted and you get a FetchError in

https://github.com/fortio/fortio/blob/master/jrpc/jrpcClient.go#L165

but maybe it should be closer to https://github.com/fortio/fortio/blob/master/jrpc/jrpcClient.go#L169

a sample repro would help understand your use case

@ldemailly
Copy link
Member

talked offline, and improving the error message in upcoming pr

ldemailly added a commit that referenced this issue Oct 24, 2022
ldemailly added a commit that referenced this issue Oct 24, 2022
…hortcut: `jrpc.GetArray()` (#634)

* add test for slice/array returned from jrpc calls as well as a cleaner shortcut jrpc.GetArray(). Also fix #633

* update test accordingly to error message change

* test the nil slice case

* prep for 1.38.2, would in theory be 1.39.0 as there is a new api but this is a super minor addition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants