Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Custom errors, extending Error#285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vplentinax merged 2 commits intojavascript-tutorial:masterfromcortizg:es.javascript.info.1-10-2-eh
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,11 +6,11 @@ class FormatError extends SyntaxError {
}
}

let err = new FormatError("formattingerror");
let err = new FormatError("error de formato");

alert( err.message ); //formattingerror
alert( err.message ); // error de formato
alert( err.name ); // FormatError
alert( err.stack ); //stack
alert( err.stack ); //pila

alert( err instanceof SyntaxError ); // true
```
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,21 +2,21 @@ importance: 5

---

#Inherit from SyntaxError
#Heredar de SyntaxError

Create a class `FormatError`that inherits from the built-in`SyntaxError` class.
Cree una clase `FormatError`que herede de la clase incorporada`SyntaxError`.

It should support`message`, `name`and `stack` properties.
Debería admitir las propiedades`message`, `name`y `stack`.

Usage example:
Ejemplo de uso:

```js
let err = new FormatError("formattingerror");
let err = new FormatError("error de formato");

alert( err.message ); //formattingerror
alert( err.message ); // error de formato
alert( err.name ); // FormatError
alert( err.stack ); //stack
alert( err.stack ); //pila

alert( err instanceof FormatError ); // true
alert( err instanceof SyntaxError ); // true (because inherits from SyntaxError)
alert( err instanceof SyntaxError ); // true (porque hereda de SyntaxError)
```
Loading

[8]ページ先頭

©2009-2025 Movatter.jp