Skip to content

Commit 066175d

Browse files
author
Gonzalo Diaz
committed
[BUGFIX:] [Hacker Rank] Interview Preparation Kit: Arrays: New Year Chaos.
error 'e' is defined but never used @typescript-eslint/no-unused-vars
1 parent 28a4a89 commit 066175d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/hackerrank/interview_preparation_kit/arrays/new_year_chaos.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ export function minimumBribes(q: number[]): number {
2828
}
2929

3030
export function minimumBribesTransform(queue: number[]): number | string {
31+
let result: number | string = '';
32+
3133
try {
32-
return minimumBribes(queue);
33-
} catch (e) {
34-
return TOO_CHAOTIC_ERROR;
34+
result = minimumBribes(queue);
35+
} catch (err: unknown) {
36+
if (err instanceof Error) {
37+
result = err.message;
38+
}
3539
}
40+
41+
return result;
3642
}
3743

3844
export default { minimumBribes, minimumBribesTransform, TOO_CHAOTIC_ERROR };

0 commit comments

Comments
 (0)