From 492a9bc25ade143650650bfaeb7893a5dfb18758 Mon Sep 17 00:00:00 2001 From: Rabeeh Ebrahim <65481473+codewithrabeeh@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:40:26 +0530 Subject: [PATCH 1/2] changed fistname into firstname in code example. --- 14_Day_Error_handling/14_day_error_handling.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/14_Day_Error_handling/14_day_error_handling.md b/14_Day_Error_handling/14_day_error_handling.md index bc17c5d..928c8c9 100644 --- a/14_Day_Error_handling/14_day_error_handling.md +++ b/14_Day_Error_handling/14_day_error_handling.md @@ -55,21 +55,21 @@ try { ```js try { let lastName = 'Yetayeh' - let fullName = fistName + ' ' + lastName + let fullName = firstName + ' ' + lastName } catch (err) { console.log(err) } ``` ```sh -ReferenceError: fistName is not defined +ReferenceError: firstName is not defined at :4:20 ``` ```js try { let lastName = 'Yetayeh' - let fullName = fistName + ' ' + lastName + let fullName = firstName + ' ' + lastName } catch (err) { console.error(err) // we can use console.log() or console.error() } finally { @@ -78,7 +78,7 @@ try { ``` ```sh -ReferenceError: fistName is not defined +ReferenceError: firstName is not defined at :4:20 In any case it will be executed ``` @@ -88,7 +88,7 @@ The catch block take a parameter. It is common to pass e, err or error as a para ```js try { let lastName = 'Yetayeh' - let fullName = fistName + ' ' + lastName + let fullName = firstName + ' ' + lastName } catch (err) { console.log('Name of the error', err.name) console.log('Error message', err.message) @@ -99,7 +99,7 @@ try { ```sh Name of the error ReferenceError -Error message fistName is not defined +Error message firstName is not defined In any case I will be executed ``` From 4edac0ccd49e8ec9c71a3072344247d8330a6ebf Mon Sep 17 00:00:00 2001 From: Rabeeh Ebrahim <65481473+codewithrabeeh@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:57:52 +0530 Subject: [PATCH 2/2] fixed spelling mistake --- 14_Day_Error_handling/14_day_error_handling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14_Day_Error_handling/14_day_error_handling.md b/14_Day_Error_handling/14_day_error_handling.md index 928c8c9..d17e7bd 100644 --- a/14_Day_Error_handling/14_day_error_handling.md +++ b/14_Day_Error_handling/14_day_error_handling.md @@ -103,7 +103,7 @@ Error message firstName is not defined In any case I will be executed ``` -throw: the throw statement allows us to create a custom error. We can through a string, number, boolean or an object. Use the throw statement to throw an exception. When you throw an exception, expression specifies the value of the exception. Each of the following throws an exception: +throw: the throw statement allows us to create a custom error. We can throw a string, number, boolean or an object. Use the throw statement to throw an exception. When you throw an exception, expression specifies the value of the exception. Each of the following throws an exception: ```js throw 'Error2' // generates an exception with a string value