Reading error messages
Your new best friends
As programmers we want to build things that work. When we do exercises we want to figure out the solution to the given problem. Seeing error messages therefore has a negative connotation to it: we haven’t managed to get it right! Right?
Well, yes. But also, no. Errors can also indicate progress. Often error messages indicate that we’ve done the right first step, and now have to figure out the right next step.
Whenever you find an error message printed on your terminal, don’t fret. Instead, appreciate it. Read it carefully. Ruby is trying to give you a hand and help. Normally an error message tells you exactly what went wrong in your code, and where. Once you’ve understood what has happened look at your code and try to understand why it happened, and how you might fix it.
Often, when you fix one thing, you’ll get a different error message. That’s progress. Rinse and repeat until your code does what you want.
For a beginner, Ruby error messages can sometimes be hard to read. There are certain conventions used, e.g. for indicating there’s an instance of a certain class involved. Backtraces might be hard to read and might look frightening. But all they do is tell you the exact path of execution Ruby took until it ended up raising an error.
If you do not understand an error message and you have the opportunity to ask someone else, then do so. You’ll get better and better at reading error messages over time. And you’ll become friends with them.