# Object with an error in JavaScript

If an exception occurs, then the first parameter of a `catch`-block will contain the object with an error that has occurred. The `name` property of this object contains the name of the error (in fact, its type), and the `message` property contains a text of this error:

`try { } catch (error) { console.log(error.name); // an error name console.log(error.message); // an error text }`

On purpose, make an exceptional situation for trying to parse malformed JSON. Print a name and text of this error to the console.

On purpose, make an exceptional situation related to local storage overflow. Print a name and text of this error to the console.

← →
↑
en ru