From 6f72c6f2ac02072386d3ac9f475b535ec8739ae0 Mon Sep 17 00:00:00 2001 From: zhongsp Date: Wed, 11 Apr 2018 08:58:23 +0800 Subject: [PATCH] Improved code in 'Modules'. PR748 --- doc/handbook/Modules.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/handbook/Modules.md b/doc/handbook/Modules.md index 11dafb5..5a52e23 100644 --- a/doc/handbook/Modules.md +++ b/doc/handbook/Modules.md @@ -769,8 +769,9 @@ class ProgrammerCalculator extends Calculator { constructor(public base: number) { super(); - if (base <= 0 || base > ProgrammerCalculator.digits.length) { - throw new Error("base has to be within 0 to 16 inclusive."); + const maxBase = ProgrammerCalculator.digits.length; + if (base <= 0 || base > maxBase) { + throw new Error(`base has to be within 0 to ${maxBase} inclusive.`); } }