{"record":{"id":"0229c01e70f7b0a5","repo":"appsmithorg/appsmith","slug":"error-message","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"exception","errorClass":"GeoLocationError","httpStatus":null,"severity":"error","filePath":"app/client/src/sagas/ActionExecution/geolocationSaga.ts","lineNumber":141,"sourceCode":"  const { payload: actionPayload } = action;\n\n  try {\n    const location: GeolocationPosition = yield call(\n      getUserLocation,\n      actionPayload.options,\n    );\n    const currentLocation = extractGeoLocation(location);\n\n    yield put(setUserCurrentGeoLocation(currentLocation));\n\n    return currentLocation;\n  } catch (error) {\n    yield call(showToastOnExecutionError, (error as Error).message);\n\n    if (error instanceof GeolocationPositionError) {\n      const sanitizedError = sanitizeGeolocationError(error);\n\n      throw new GeoLocationError(sanitizedError.message, [sanitizedError]);\n    }\n  }\n}\n\nlet watchId: number | undefined;\n\nexport function* watchCurrentLocation(\n  action: TWatchGeoLocationDescription,\n  _: EventType,\n  triggerMeta: TriggerMeta,\n) {\n  const { payload: actionPayload } = action;\n\n  if (watchId) {\n    // When a watch is already active, we will not start a new watch.\n    // at a given point in time, only one watch is active\n    yield call(\n      showToastOnExecutionError,","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/client/src/sagas/ActionExecution/geolocationSaga.ts#L123-L159","documentation":"Re-thrown inside getCurrentLocationSaga's catch block. After a toast is shown, if the caught error is specifically a GeolocationPositionError, the saga sanitises it (extracting code+message only, because the GeolocationPositionError class is not structured-cloneable into the eval worker) and re-wraps it as GeoLocationError with the human message. The accompanying array carries the {code, message} object so callers can branch on permission-denied vs unavailable.","triggerScenarios":"Browser geolocation fails: code 1 PERMISSION_DENIED (user blocked or browser setting off), code 2 POSITION_UNAVAILABLE (no GPS / device offline), code 3 TIMEOUT (options.timeout exceeded).","commonSituations":"App served over HTTP (geolocation requires secure context); first-time permission denied and never re-prompted; testing on desktop with location disabled; user on a device with no location hardware.","solutions":["Serve the app over HTTPS (or localhost) — geolocation is a secure-context-only API.","Have the user clear the site's location permission and re-grant it.","Pass options.timeout / enableHighAccuracy thoughtfully; raise timeout for slow GPS.","In the JS object, catch the error and inspect the code to show a helpful message instead of the raw toast."],"exampleFix":"// before\nconst loc = await getCurrentPosition();\n// after\ntry {\n  const loc = await getCurrentPosition({ enableHighAccuracy: true, timeout: 10000 });\n} catch (e) {\n  showAlert('Location unavailable: ' + (e?.responseData?.[0]?.code === 1 ? 'permission denied' : 'unavailable'));\n}","handlingStrategy":"try-catch","validationCode":"if (!('geolocation' in navigator)) {\n  showAlert('Geolocation not supported by this browser', 'error');\n  return;\n}\nif (window.isSecureContext === false) {\n  showAlert('Geolocation requires HTTPS', 'error');\n  return;\n}","typeGuard":"function isGeolocationPositionError(e: unknown): e is GeolocationPositionError {\n  return typeof e === 'object' && e !== null && 'code' in e && 'message' in e;\n}","tryCatchPattern":"try {\n  const loc = await getCurrentPosition({ enableHighAccuracy: true, timeout: 10000 });\n} catch (e) {\n  const code = e?.responseData?.[0]?.code;\n  const hint = code === 1 ? 'permission denied' : code === 2 ? 'unavailable' : code === 3 ? 'timed out' : 'failed';\n  showAlert('Location ' + hint, 'error');\n}","preventionTips":["Serve the app over HTTPS or on localhost so geolocation is available.","Tell users how to re-grant location permission in their browser settings.","Pass a sensible options.timeout; raise it on slow devices.","Branch on the error code to give actionable messages."],"tags":["geolocation","browser-api","permissions","secure-context"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}