# Error handling in Node

**URL:** <https://forum.freecodecamp.org/t/error-handling-in-node/54429>\
**Category:** General\
**Created:** [November 11, 2016, 11:02pm UTC](https://forum.freecodecamp.org/t/error-handling-in-node/54429 "2016-11-11T23:02:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyBizzel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/johnnybizzel/32/37661_2.png) [@JohnnyBizzel](https://forum.freecodecamp.org/u/JohnnyBizzel)\
**Post date:** [November 11, 2016, 11:02pm UTC](https://forum.freecodecamp.org/t/error-handling-in-node/54429/1 "2016-11-11T23:02:36Z")

</div>

Can someone explain how to properly handle errors in Node because the tutorial makes no effort to.

```
var http = require("http");
var bl = require("bl");
var url =process.argv[2]; // 1st command line argument

http.get(url, function(err, response) {
    response.pipe(bl(function (data) {
        console.log(data);
    }));
    response.on("error", function(err) {
        throw new Error("Doh!!!");
    });
}).on('error', function(err) {
    throw new Error("Doh!!!");
});

```

![](https://global.discourse-cdn.com/freecodecamp/original/3X/8/9/89e384d367cdc65e4369ae684834ed005405b5e8.png)

Heading for the solution now. Is this the best way to learn I wonder 😕 ?

---

<div class="post-metadata">

**Author:** ![IsaacAbrahamson](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/isaacabrahamson/32/30882_2.png) [@IsaacAbrahamson](https://forum.freecodecamp.org/u/IsaacAbrahamson)\
**Post date:** [November 11, 2016, 11:29pm UTC](https://forum.freecodecamp.org/t/error-handling-in-node/54429/2 "2016-11-11T23:29:19Z")

</div>

> [@JohnnyBizzel](#):
>
> Heading for the solution now. Is this the best way to learn I wonder 😕 ?

No, its not I struggled with how-to-node too. If you want to really understand what you are doing take a look at this course, I have been taking it and its making things a lot clearer.  
[https://www.udemy.com/understand-nodejs](https://www.udemy.com/understand-nodejs)

---

<div class="post-metadata">

**Author:** ![JohnnyBizzel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/johnnybizzel/32/37661_2.png) [@JohnnyBizzel](https://forum.freecodecamp.org/u/JohnnyBizzel)\
**Post date:** [November 13, 2016, 12:45am UTC](https://forum.freecodecamp.org/t/error-handling-in-node/54429/4 "2016-11-13T00:45:24Z")

</div>

Thanks for that @P1xt & @IsaacAbrahamson . I am currently going through the [linked in / learning](https://www.linkedin.com/learning/) course. That’s 6 hrs long and very good so far.  
Also, I have Pair programmed with someone today and completed the **learnyounode** course.  
What helped today was looking at [NodeJS API](http://nodejs.org/api)

I think getting familiar with the many modules will help. I will watch those before moving to the next challenge. Cheers. 🍻

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 5:31am UTC](https://forum.freecodecamp.org/t/error-handling-in-node/54429/5 "2021-01-16T05:31:31Z")

</div>

Closed on January 16, 2021, 5:31am UTC


