Location
Location Service
Description
- Geolocation Handling for Toolstation Web.
getCurrentLocation(): Promise<Geoposition>
- Description: Requests the user's current geographical location using the browser’s Geolocation API.
- Returns: A Promise that resolves with a
Geopositionobject containing:latitude(asstring)longitude(asstring)
- Error Handling:
- If the location fetch fails (e.g., permission denied, timeout), the error is:
- Rejected via the promise.
- Logged using
$customClientErrorHandlerwith:- Severity:
'high' - Metadata:
{ locationServiceError: true } - Description:
'Location Service Error - trying to getCurrentLocation() using getCurrentLocation()'
- Severity:
- If the location fetch fails (e.g., permission denied, timeout), the error is:
- Fallback: If geolocation is not supported by the browser, it rejects with a descriptive error message.