nodules / asker

http.request wrapper with gzip, request retries and http.Agent tuning
MIT License
93 stars 11 forks source link

Make error message more informative #97

Closed dfilatov closed 9 years ago

dfilatov commented 9 years ago

In case of HTTP_CLIENT_REQUEST_ERROR I'm not able to get original error message.

Asker error message: http.clientRequest error for request in 16~34 ms ... Original error message (from http module): CERT_UNTRUSTED

Or maybe I'm missing something, aren't I?

kaero commented 9 years ago

You are right. Will be fixed soon.

kaero commented 9 years ago

You can get original error from the field originalError. If you have maxReties more than zero, then source error may be more one level deeper: AskerError<RETRIES_LIMIT_EXCEEDED>.originalError -> AskerError<HTTP_CLIENT_REQUEST_ERROR>.originalError -> Error<source error>

kaero commented 9 years ago

I think, it's may looks weird and confusing at first sight... So AskerError#log() write out an error message of itself and of the orignal error.

All HTTP client error are coverred by signle code, because all them mostly meaningless for the app runtime.

kaero commented 9 years ago

I've opened an issue in the terror module for properly logging of nested errors: https://github.com/nodules/terror/issues/18

kaero commented 9 years ago

Fixed in asker 0.6.0 and vow-asker 0.8.0