mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 14:30:02 -04:00
add libcurl error strings to fetch error messages
This commit is contained in:
parent
c9236f90d5
commit
155d5ea5b6
8 changed files with 18 additions and 10 deletions
|
@ -67,7 +67,6 @@ function perform_request(url, params, js_data_callback, js_end_callback, body=nu
|
|||
_free(url_ptr);
|
||||
_free(response_json_ptr);
|
||||
|
||||
if (error != 0) console.error("request failed with error code " + error);
|
||||
active_requests --;
|
||||
js_end_callback(error, response_info);
|
||||
}
|
||||
|
@ -172,7 +171,9 @@ function perform_request_async(url, params, body) {
|
|||
|
||||
let finish_callback = (error, response_info) => {
|
||||
if (error != 0) {
|
||||
reject("libcurl.js encountered an error: " + error);
|
||||
let error_str = `Request failed with error code ${error}: ${get_error_str(error)}`;
|
||||
if (error != 0) error_msg(error_str);
|
||||
reject(error_str);
|
||||
return;
|
||||
}
|
||||
let response_data = merge_arrays(chunks);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue