-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: add detailed timeout error #170
Conversation
12bc0a9
to
868f3e4
Compare
When a timeout occurs, now the error message is like: ``` Timeout of 1000 ms reached. Total time: 1000.527000 ms (DNS time: 0.084000 ms, TCP/SSL handshake time: 0.314000 ms, HTTP Request/Response time: 1000.014000 ms) ``` Before it used to be: ``` Timeout was reached ``` Closes supabase#169.
868f3e4
to
acfdd76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. All tests pass on my laptop, although I had to increase timeout in time.sleep
call within test_http_detailed_timeout()
and test_http_get_succeed_with_gt_timeout()
.
I have couple of suggestions. One is mentioned below. And the second: would it make more sense to add new column error_detail
to net._http_response
? That way it would be easier to make queries to the table without using pattern matching.
src/core.c
Outdated
|
||
// build the error message | ||
curl_timeout_msg result = {.msg = {}}; | ||
sprintf(result.msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is safer to call snprintf
to make sure that the result string won't be larger than result.msg
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, done. Also went ahead and moved all this logic to a more proper errors.hs
module.
1 similar comment
@za-arthur I thought about that too, but the problem is that users will likely ignore the new detail column and the goal is for them to pay attention to these timings. Additionally, we don't add more details to other error messages, just this one. All the other errors come raw from libcurl. So not much use for the new column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix. LGTM.
Closes #169.
When a timeout occurs, now the error message is like:
Before it used to be: