Fix error types classification#44234
Conversation
The section was previously titled ‘Fixing syntax errors’, but the example it contained actually showed a runtime error: ‘Uncaught TypeError: guessSubmit.addeventListener is not a function’, which could be confusing for readers. This commit updates the section title and clarifies the classification of error types by introducing a proper description of runtime errors. This makes the examples consistent with the definitions provided earlier in the document and improves overall accuracy.
There was a problem hiding this comment.
Pull request overview
This PR updates the “What went wrong?” learning article to better align its terminology with the JavaScript error shown in the console example, clarifying the distinction between syntax, runtime, and logic errors.
Changes:
- Expands the “Types of error” section from two to three categories by adding runtime errors.
- Renames the section previously focused on “syntax errors” to a more accurate “errors reported in the console” framing.
- Renames follow-up subsections to remove “syntax errors” wording where the examples are runtime TypeErrors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| At this point, let's consult the developer console to see if it reports any syntax errors, then try to fix them. You'll learn how below. | ||
|
|
||
| ## Fixing syntax errors | ||
| ## Fixing errors reported in the console |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
chrisdavidmills
left a comment
There was a problem hiding this comment.
@Piesikot Thanks. I understand what you're aiming for here, but it still needs some work. I deliberately kept the article really simple for the target audience. I think that, for this to work well, it needs to be really clear on what a runtime error is, and how it differs from a syntax error. And it needs to be clear what types of errors the examples cover.
|
|
||
| - **Syntax errors**: These are spelling errors in your code that actually cause the program not to run at all, or stop working part way through — you will usually be provided with some error messages too. These are usually not too hard to fix, as long as you are familiar with the right tools and know what the error messages mean! | ||
| - **Logic errors**: These are errors where the syntax is actually correct but the code is not what you intended it to be, meaning that program runs successfully but gives incorrect results. These are often harder to fix than syntax errors, as there usually isn't an error message to direct you to the source of the error. | ||
| - **Runtime errors**: Runtime errors occur when the code has valid syntax, so the program starts running, but an error happens during execution. Examples include TypeError, ReferenceError, and RangeError. |
There was a problem hiding this comment.
I wouldn't include the examples here, as the reader is probably not going to know what TypeError, ReferenceError, and RangeError mean, so it isn't helpful.
Also, the description needs to say why an error happens during execution. The syntax is valid, so why does it cause an error?
There was a problem hiding this comment.
Thanks! Since I'm still learning JavaScript error types myself, this part of the article felt confusing. I understand the need to keep the explanation simple, so I’ve reduced it to a single, beginner‑friendly example and focused on explaining why a runtime error happens even when the syntax is valid. I’ve added a simplified suggestion above.
| > See our [TypeError: "x" is not a function](/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function) reference page for more details about this error. | ||
|
|
||
| ### Syntax errors round two | ||
| ### Fixing errors round two |
There was a problem hiding this comment.
This change immediately makes the article more confusing to read because now the reader isn't sure what type of error is being covered in these sections. If you really want to make this work well, maybe describe this section as dealing with a runtime error?
| > See our [TypeError: "x" is (not) "y"](/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_type) reference page for more details about this error. | ||
|
|
||
| ### Syntax errors round three | ||
| ### Fixing errors round three |
There was a problem hiding this comment.
However, I'd defintiely argue that this one is a Syntax error
There was a problem hiding this comment.
You're right, so I’ll leave this one as it is.
Piesikot
left a comment
There was a problem hiding this comment.
Thanks for the feedback! I’ve updated the runtime‑error explanation to keep it simple and beginner‑friendly, and left the third example as it is.
|
Thanks for the review! I see that some of the earlier descriptions were accidentally reverted in the diff. I’ll fix those sections and update the PR accordingly. |
1 similar comment
|
Thanks for the review! I see that some of the earlier descriptions were accidentally reverted in the diff. I’ll fix those sections and update the PR accordingly. |
|
Preview URLs (1 page) External URLs (1)URL:
(comment last updated: 2026-05-25 09:06:51) |
…ng/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chrisdavidmills
left a comment
There was a problem hiding this comment.
Thanks again, @Piesikot. I decided to fix up the titles, to make it clear what error type is being dealt with in each case. I also ran it through Grammarly and applied the resulting grammar fixes.
Description
This PR clarifies the classification of JavaScript error types in the “What went wrong?” article.
It updates the description of runtime errors and adjusts the section title to match the example shown.
Motivation
The section was previously titled “Fixing syntax errors”, but the example it contained actually showed a runtime error (Uncaught TypeError: guessSubmit.addeventListener is not a function).
This mismatch could confuse readers who are learning how to distinguish error types.
The updated text improves accuracy and consistency across the article.
Additional details
The changes align the terminology with the actual behavior of JavaScript errors and ensure that the examples match the definitions provided earlier in the document.
Related issues and pull requests
None.