what's the difference between request.on('error') and response.on('error')

bubakazouba

when making an http.request there are 2 events that produce errors: request.on('error') and response.on('error').

I can't see a difference because both errors come from the web server.

what's the difference between thisError and thatError ?

var request = http.request({hostname:"example.com"}, function(response){
    response.on('error', function(thisError){
     //what's the difference between thisError <<<<<<
    });
});
request.on('error', function(thatError){
    //and thatError      <<<<<
});
skypjack

During a request you resolve a name, establish a connection, send a bunch of data, and each task could result in an error.

When you receive data through a response object, as an example the other end could close the connection unexpectedly.

Those errors are different and they must belong to the right structure, in this case respectively request and response.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

In Angular, what's the conceptual difference between the error and catch functions for promises?

From Dev

What's the difference between panic("error_msg") and panic(error.New("error_msg")?

From Dev

What's the difference between a Pull Request and a branch?

From Dev

What's the difference between a Pull Request and a branch?

From Dev

What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)

From Dev

What is the difference between error, stderr, stdout in node

From Dev

SSIS - What is difference between Error and Truncation?

From Dev

Difference between error= and error=''

From Dev

What's the difference between response.body() and object returned by the callback?

From Dev

What's the difference between console.log and response.write?

From Dev

What is the difference between throw Error and console.error

From Dev

What is the difference between rel error and x error in a rpart decision tree?

From Dev

What is the difference between the error "not found" and the error "command not found" are they the same?

From Java

What's the difference between a POST and a PUT HTTP REQUEST?

From Dev

Doing an asynchronous HTTP request - what's the difference between these two?

From Dev

What's the difference between "as?", "as!", and "as"?

From Java

What's the difference between '$(this)' and 'this'?

From Dev

What's the difference between "./" and "../"?

From Dev

What's the difference between "==" and "=~"?

From Dev

What's the difference between $@ and $*

From Dev

what's difference between these

From Dev

What's the difference between([])+ and []+?

From Dev

Difference between Event Aggregator, Commands and Request/Response

From Dev

Difference between GET and POST in an HTTP response (not request)

From Dev

Difference between GET and POST in an HTTP response (not request)

From Dev

What is the difference between a request payload and request body?

From Dev

What is the difference between a request payload and request body?

From Dev

request-promise error with response

From Dev

What is the difference between FAILED AND ERROR in spark application states

Related Related

  1. 1

    In Angular, what's the conceptual difference between the error and catch functions for promises?

  2. 2

    What's the difference between panic("error_msg") and panic(error.New("error_msg")?

  3. 3

    What's the difference between a Pull Request and a branch?

  4. 4

    What's the difference between a Pull Request and a branch?

  5. 5

    What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)

  6. 6

    What is the difference between error, stderr, stdout in node

  7. 7

    SSIS - What is difference between Error and Truncation?

  8. 8

    Difference between error= and error=''

  9. 9

    What's the difference between response.body() and object returned by the callback?

  10. 10

    What's the difference between console.log and response.write?

  11. 11

    What is the difference between throw Error and console.error

  12. 12

    What is the difference between rel error and x error in a rpart decision tree?

  13. 13

    What is the difference between the error "not found" and the error "command not found" are they the same?

  14. 14

    What's the difference between a POST and a PUT HTTP REQUEST?

  15. 15

    Doing an asynchronous HTTP request - what's the difference between these two?

  16. 16

    What's the difference between "as?", "as!", and "as"?

  17. 17

    What's the difference between '$(this)' and 'this'?

  18. 18

    What's the difference between "./" and "../"?

  19. 19

    What's the difference between "==" and "=~"?

  20. 20

    What's the difference between $@ and $*

  21. 21

    what's difference between these

  22. 22

    What's the difference between([])+ and []+?

  23. 23

    Difference between Event Aggregator, Commands and Request/Response

  24. 24

    Difference between GET and POST in an HTTP response (not request)

  25. 25

    Difference between GET and POST in an HTTP response (not request)

  26. 26

    What is the difference between a request payload and request body?

  27. 27

    What is the difference between a request payload and request body?

  28. 28

    request-promise error with response

  29. 29

    What is the difference between FAILED AND ERROR in spark application states

HotTag

Archive