Skip to content

Commit 4a94139

Browse files
committed
Tweak
1 parent 0cf33d1 commit 4a94139

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

typescript/euler/bin/p0004.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { isPalindrome, range } from "../lib/util.ts";
55

66
export const compute = (digits: number): string => {
77
if (digits <= 0) {
8-
throw new Error("range error");
8+
throw new RangeError(`argument must be larger than 0 (digits = ${digits})`);
99
}
1010

1111
const nUpper = (10 ** digits) - 1;

typescript/euler/bin/p0041.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const compute = (): string => {
2929
}
3030
}
3131

32-
throw new Error("Not reached");
32+
throw new Error("not reached");
3333
};
3434

3535
export const solve = (): string => compute();

typescript/euler/bin/p0061.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const compute = (maxNumSidesPolygon: number): string => {
110110
return String(sum(cycles[0].slice(1)) * 101);
111111
}
112112

113-
throw new Error("unreachable");
113+
throw new Error("not reached");
114114
};
115115

116116
export const solve = (): string => compute(8);

typescript/euler/bin/p0092.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const isGroup89 = (n: number): boolean => {
8080
export const compute = (limit: number): string => {
8181
if (!Number.isInteger(Math.log10(limit)) || limit === 0) {
8282
throw new Error(
83-
"This implementation works correctly only if the limit is a power of 10.",
83+
`this implementation works correctly only if the limit is a power of 10. (limit = ${limit})`,
8484
);
8585
}
8686
const ndigits = numOfDigits(limit) - 1;

typescript/euler/bin/p0096.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ const parseData = (data: string): string[] => {
234234
}
235235

236236
if (result.some((x) => x.length !== 81)) {
237-
throw new Error("Invalid data file");
237+
throw new Error("invalid data file");
238238
}
239239

240240
return result;

0 commit comments

Comments
 (0)