Skip to content

Commit

Permalink
fix(#8442): Unique code for geolocation telemetry:failure telemetry e…
Browse files Browse the repository at this point in the history
…vents (#8445)

geolocation:failure telemetry events are not currently unique becuase the error code -1 is used for multiple failure modes (both Geolocation timeout exceeded and Geolocation API unavailable). This proposes to use new unique error codes for each reason.
  • Loading branch information
kennsippell authored Sep 7, 2023
1 parent 3ae0e37 commit da48e62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions webapp/src/ts/services/geolocation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export class GeolocationService {
console.debug('Initiating new geolocation watcher');
if (!window.navigator.geolocation) {
return this.failure({
code: -1,
message: 'Geolocation API unavailable.',
code: -3,
message: 'Geolocation API unavailable',
});
}

Expand All @@ -92,7 +92,7 @@ export class GeolocationService {
this.GEO_OPTIONS
);
this.timeout = setTimeout(() => {
this.failure({ code: -1, message: 'Geolocation timeout exceeded' });
this.failure({ code: -2, message: 'Geolocation timeout exceeded' });
}, this.GEO_OPTIONS.timeout + 1);
}

Expand Down
6 changes: 3 additions & 3 deletions webapp/tests/karma/ts/services/geolocation.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('Geolocation service', () => {
sinon.replaceGetter(window, 'navigator', () => ({}));
return service.init()().then(returned => {
expect(returned).to.deep.equal({
code: -1,
message: 'Geolocation API unavailable.',
code: -3,
message: 'Geolocation API unavailable',
});
});
});
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Geolocation service', () => {

return deferred().then(error => {
expect(error).to.deep.equal({
code: -1,
code: -2,
message: 'Geolocation timeout exceeded'
});
});
Expand Down

0 comments on commit da48e62

Please sign in to comment.