Conversation
Assignment-5/CarDrive.ts
Outdated
| } | ||
|
|
||
| function handleNatureRelatedAccident() { | ||
| callAmbulance(); |
There was a problem hiding this comment.
The method callAmbulance is common in multiple exceptions, please check if we can move it to finally or have an alternate solution
There was a problem hiding this comment.
No , it is only in 3 exceptions and also finally block will execute, irrespective of whether or not an accident occurs, so we can't call ambulance in finally .
There was a problem hiding this comment.
So in that case, please add the positive scenario condition also where no exception is there and the car reaches the destination safely.
Assignment-5/CarDrive.ts
Outdated
| } | ||
|
|
||
| function driveCar() { | ||
| const isCarBreakFail = true; |
There was a problem hiding this comment.
Cannot we use enums here?
mukulpalol16
left a comment
There was a problem hiding this comment.
Wouldn't it be better if you make a class in CareDrive.ts file and have the try-catch there to also be able to maintian SRP?
There was a problem hiding this comment.
I guess there is a typo. It should be ErrorHandler.ts
Assignment-5/CarDrive.ts
Outdated
| @@ -0,0 +1,94 @@ | |||
| import { Actions } from './ErrorHanler'; | |||
There was a problem hiding this comment.
Check for the typo in the file name
No description provided.