-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hi,
Would it be possible to cleanup the error messages of the forward function ?
throw new TypeError('forward did not receive an array');
throw new TypeError('forward received an array of strings, but it only accepts an array of numbers.');
throw new TypeError(`forward received an invalid longitude of ${lon}`);
throw new TypeError(`forward received an invalid latitude of ${lat}`);
throw new TypeError(`forward received a latitude of ${lat}, but this library does not support conversions of points in polar regions below 80°S and above 84°N`);
If you look at thetoPoint function, the error messages are much cleaner.
throw new Error(`MGRSPoint bad conversion from: ${mgrsString}`);
throw new Error(`MGRSPoint bad conversion from ${mgrsString}`);
throw new Error(`MGRSPoint zone letter ${zoneLetter} not handled: ${mgrsString}`);
throw new Error(`MGRSPoint has to have an even number of digits after the zone letter and two 100km letters - front half for easting meters, second half for northing meters ${mgrsString}`);
Here is what I propose:
// LatLong
throw new TypeError('LatLong: Did not receive an array');
throw new TypeError('LatLong: Received an array of strings, but expect an array of numbers.');
throw new TypeError(`LatLong: Received an invalid longitude of ${lon}`);
throw new TypeError(`LatLong: Received an invalid latitude of ${lat}`);
throw new TypeError(`LatLong: Received a latitude of ${lat}, but does not support conversions of points in polar regions below 80°S and above 84°N`);
// MGRS
throw new Error(`MGRS: Bad conversion from: ${mgrsString}`);
throw new Error(`MGRS: Bad conversion from ${mgrsString}`);
throw new Error(`MGRS: Zone letter ${zoneLetter} not handled: ${mgrsString}`);
throw new Error(`MGRS: Expect an even number of digits after the zone letter and two 100km letters - front half for easting meters, second half for northing meters ${mgrsString}`);
Metadata
Metadata
Assignees
Labels
No labels