Errors over Errors

·

0 min read

Developing an application without errors isn't easy. There has to be a reason why we have the Try-Catch block in JavaScript.

try {
 // try your best to not get an error
} catch (err) {
  // handle error
}

Note: This is my first blog post on Hashnode

Sometimes, we get an error that is simple and we look at the line number and know our mistake. But sometimes we get an error that we have never seen before.

If you have developed in React before, especially with Create-React-App, then you know how large the red letters of the error take over your application.

Main Topic

So exactly, what am I writing this? Well, for inspiration and motivation to continue moving on after you get an error.

Let me share a personal story.

I am currently developing an application using React and Firebase. While I was developing, (today), I was trying to implement Protected Routes so no one can access a route that is protected and only logged-in users could.

While developing that feature, I was faced with an error by React, The error had something to do with the backend of React. It didn't clearly state what I was doing wrong, but it showed me what was going wrong in the backend.

Now, this usually hints me towards thinking that I should undo my last change, and well I did.

The error didn't go away.

I restarted the React Dev server. Maybe it was a caching issue or something.

Nope.

I restarted the browser, maybe it was a browser issue.

Nope.

This error has currently not only affected me in my application. But has affected me mentally.

So this is what I want to talk about.

Mental Effect from Errors

When you get an error, your first reaction might be to quit the developing and either start from scratch or maybe create something new. But, if you decide to quit in all from the application you are building, then let me tell you that was the biggest mistake you just made.

But, let me tell you this. When I was faced with my error, I decided to take a break and work on something else. But... My brain didn't want to develop something new or work on something else.

So, you might be thinking, well there must be a solution or a cure. Well, the only cure I have thought of so far is to distract yourself. Like, go chill out. But once you feel better a bit, come back, and try attempting the error again.

Sometimes, while I go chill out, I end up thinking of the solution, or I think about a way to get around the error I just faced. Either way, just chilling out could make you feel much better.

So, I want you to leave this post with a message and that is that we should not be afraid of errors instead, the errors should be scared of you.

Remember, you are a developer even if you face an error every line of code you write.