Skip to content

Commit e3d913e

Browse files
Addressing feedback
1 parent fa5c112 commit e3d913e

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class Firestore {
216216
* `Timestamp` instead.
217217
* <br/>NOTE: in the future `timestampsInSnapshots: true` will become the
218218
* default and this option will be removed so you should change your code to
219-
* use Timestamp now and opt-in to this new behavior as soon as you can.
219+
* use `Timestamp` now and opt-in to this new behavior as soon as you can.
220220
*/
221221
constructor(options) {
222222
options = extend({}, options, {

src/validate.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ module.exports = validators => {
5656
return false;
5757
}
5858
if (value < min || value > max) {
59-
throw new Error(`Value must be within [${min}, ${max}] inclusive.`);
59+
throw new Error(
60+
`Value must be within [${min}, ${max}] inclusive, but was: ${value}`
61+
);
6062
}
6163
return true;
6264
},
@@ -67,7 +69,9 @@ module.exports = validators => {
6769
return false;
6870
}
6971
if (value < min || value > max) {
70-
throw new Error(`Value must be within [${min}, ${max}] inclusive.`);
72+
throw new Error(
73+
`Value must be within [${min}, ${max}] inclusive, but was: ${value}`
74+
);
7175
}
7276
return true;
7377
},

test/document.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,11 @@ describe('serialize document', function() {
470470

471471
assert.throws(() => {
472472
new Firestore.GeoPoint(91, 0);
473-
}, /Argument "latitude" is not a valid number. Value must be within \[-90, 90] inclusive/);
473+
}, /Argument "latitude" is not a valid number. Value must be within \[-90, 90] inclusive, but was: 91/);
474474

475475
assert.throws(() => {
476476
new Firestore.GeoPoint(90, 181);
477-
}, /Argument "longitude" is not a valid number. Value must be within \[-180, 180] inclusive/);
477+
}, /Argument "longitude" is not a valid number. Value must be within \[-180, 180] inclusive, but was: 181/);
478478
});
479479

480480
it('resolves infinite nesting', function() {

test/timestamp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ describe('timestamps', function() {
209209

210210
assert.throws(
211211
() => new Firestore.Timestamp(0, -1),
212-
/Argument "nanoseconds" is not a valid integer. Value must be within \[0, 999999999] inclusive/
212+
/Argument "nanoseconds" is not a valid integer. Value must be within \[0, 999999999] inclusive, but was: -1/
213213
);
214214

215215
assert.throws(
216216
() => new Firestore.Timestamp(0, 1000000000),
217-
/Argument "nanoseconds" is not a valid integer. Value must be within \[0, 999999999] inclusive/
217+
/Argument "nanoseconds" is not a valid integer. Value must be within \[0, 999999999] inclusive, but was: 1000000000/
218218
);
219219
});
220220
});

types/firestore.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ declare namespace FirebaseFirestore {
7272
*
7373
* NOTE: in the future `timestampsInSnapshots: true` will become the
7474
* default and this option will be removed so you should change your code to
75-
* use Timestamp now and opt-in to this new behavior as soon as you can.
75+
* use `Timestamp` now and opt-in to this new behavior as soon as you can.
7676
*/
7777
timestampsInSnapshots?: boolean;
7878

0 commit comments

Comments
 (0)