Skip to content

Commit f675e33

Browse files
authored
Merge pull request javascript-tutorial#821 from 11un/patch-17
typo "if" --> "it"
2 parents bf779f9 + 57ef354 commit f675e33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/08-error-handling/2-custom-errors/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let json = `{ "name": "John", "age": 30 }`;
1919

2020
Internally, we'll use `JSON.parse`. If it receives malformed `json`, then it throws `SyntaxError`.
2121

22-
But even if `json` is syntactically correct, that doesn't mean that it's a valid user, right? It may miss the necessary data. For instance, if may not have `name` and `age` properties that are essential for our users.
22+
But even if `json` is syntactically correct, that doesn't mean that it's a valid user, right? It may miss the necessary data. For instance, it may not have `name` and `age` properties that are essential for our users.
2323

2424
Our function `readUser(json)` will not only read JSON, but check ("validate") the data. If there are no required fields, or the format is wrong, then that's an error. And that's not a `SyntaxError`, because the data is syntactically correct, but another kind of error. We'll call it `ValidationError` and create a class for it. An error of that kind should also carry the information about the offending field.
2525

0 commit comments

Comments
 (0)