Encountering Errors in Programming: Tips

blog / April 21st, 2021

As a newbie to programming, here are some basic tips I've learned on what to do if I get stuck, or have encountered an error:

1. Identify the error in your console or logs. Check what and where the error is in your code, and see if it's an error you are able to fix immediately. Your editor might be able to point out the error, and even recommend a quick fix. The web developer tools in your browser may also provide a way to identify your problem.

2. If you cannot fix the error, read what the error says again. Based off that, pick and read the appropriate documentation for the language, library, or editor you're using. Read (or re-read) the sections that are the most relevant to your error and check if there is a solution.

3. If you still cannot fix the error, copy and paste it in Google. Common websites that have solutions include:

  • Stack Overflow. First, check to see if a question asked on Stack Overflow has been solved. If it has been solved and the approved solution makes sense, try and apply it. It it doesn't work, or if the question has not been solved, read other solutions for that question or check other questions on Stack Overflow.

  • GitHub. If the issue is related to a certain library, framework, or package that has a repository on GitHub, check the Issues section for that GitHub repository. This contains questions and discussion for issues that users are experiencing, and may have a solution for your problem.

Check other links as well! If you don't think your Google search has yielded enough results, perform another search using different terms. Sometimes, less words are better.

4. If you are still unable to figure out your problem, or if there is nobody else who is experiencing the same problems you are having after doing a Google search (highly unlikely), then ask your question on Stack Overflow or any other relevant discussion boards. Make sure your question is clear and easy to understand. Provide examples of what solutions you have attempted so far.

It's important to remember that errors are common, and you're not expected to know the solution immediately. I have to remind myself all the time to follow these tips. Programming is essentially one big open-book exam!