Skip to content

Fix error types classification#44234

Merged
chrisdavidmills merged 10 commits into
mdn:mainfrom
Piesikot:fix-error-types-classification
May 25, 2026
Merged

Fix error types classification#44234
chrisdavidmills merged 10 commits into
mdn:mainfrom
Piesikot:fix-error-types-classification

Conversation

@Piesikot
Copy link
Copy Markdown
Contributor

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.

Piesikot added 3 commits May 23, 2026 16:13
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.
Copilot AI review requested due to automatic review settings May 23, 2026 15:59
@Piesikot Piesikot requested a review from a team as a code owner May 23, 2026 15:59
@Piesikot Piesikot requested review from chrisdavidmills and removed request for a team May 23, 2026 15:59
@github-actions github-actions Bot added Content:Learn Learning area docs size/s [PR only] 6-50 LoC changed labels May 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +53 to +55
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
Comment thread files/en-us/learn_web_development/core/scripting/what_went_wrong/index.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I'd defintiely argue that this one is a Syntax error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, so I’ll leave this one as it is.

Comment thread files/en-us/learn_web_development/core/scripting/what_went_wrong/index.md Outdated
Copy link
Copy Markdown
Contributor Author

@Piesikot Piesikot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Piesikot
Copy link
Copy Markdown
Contributor Author

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
@Piesikot
Copy link
Copy Markdown
Contributor Author

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.

Comment thread files/en-us/learn_web_development/core/scripting/what_went_wrong/index.md Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

Preview URLs (1 page)

External URLs (1)

URL: /en-US/docs/Learn_web_development/Core/Scripting/What_went_wrong
Title: What went wrong? Troubleshooting JavaScript

(comment last updated: 2026-05-25 09:06:51)

chrisdavidmills and others added 2 commits May 25, 2026 09:42
…ng/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions Bot added size/m [PR only] 51-500 LoC changed and removed size/s [PR only] 6-50 LoC changed labels May 25, 2026
Copy link
Copy Markdown
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chrisdavidmills chrisdavidmills merged commit 2cd7354 into mdn:main May 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Learn Learning area docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants