Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class FormatError extends SyntaxError {
}
}

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

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

alert( err instanceof SyntaxError ); // true
```
16 changes: 8 additions & 8 deletions 1-js/10-error-handling/2-custom-errors/1-format-error/task.md
Original file line number Diff line number Diff 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("formatting error");
let err = new FormatError("error de formato");

alert( err.message ); // formatting error
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