Skip to content

Commit 0e61654

Browse files
committed
Changed 13 solutions
1 parent b205a83 commit 0e61654

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

src/13-catch-blocks.solution.1.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ const tryCatchDemo = (state: "fail" | "succeed") => {
55
if (state === "fail") {
66
throw new Error("Failure!");
77
}
8-
} catch (e) {
9-
if (e instanceof Error) {
10-
return e.message;
11-
}
8+
} catch (e: any) {
9+
return e.message;
1210
}
1311
};
1412

src/13-catch-blocks.solution.2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const tryCatchDemo = (state: "fail" | "succeed") => {
66
throw new Error("Failure!");
77
}
88
} catch (e) {
9-
if (typeof e === "object" && e && "message" in e) {
9+
if (e instanceof Error) {
1010
return e.message;
1111
}
1212
}

src/13-catch-blocks.solution.3.ts

-15
This file was deleted.

0 commit comments

Comments
 (0)