web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit b8797cc75a8af8f5d0486d695ae74bd25cd8794a
parent 28a170548a3f0943b02f0c7af6d349ddf1f2cdf4
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Fri, 30 Aug 2024 08:42:58 +0000

client: update error handling using err_msg()

Diffstat:
Mclient/src/capacitor/geolocation.ts | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/client/src/capacitor/geolocation.ts b/client/src/capacitor/geolocation.ts @@ -1,4 +1,5 @@ import { Geolocation, type Position } from '@capacitor/geolocation'; +import { err_msg } from '@radroots/utils'; import type { IClientGeolocation, IClientGeolocationPosition, IGeolocationErrorMessage } from '../types'; import { fmt_location_coords } from '../utils'; @@ -19,14 +20,13 @@ export class CapacitorClientGeolocation implements IClientGeolocation { const position = await Geolocation.getCurrentPosition(); return this.parse_geolocation_position(position); } catch (e) { - if (typeof e.errorMessage === `string` && String(e.errorMessage).includes(`The operation couldn’t be completed`)) return `permissions-required`; + const { error } = err_msg(e); + if (error.includes(`The operation couldn’t be completed`)) return `permissions-required`; }; } public async current(): Promise<IClientGeolocationPosition | undefined | IGeolocationErrorMessage> { try { - //const permitted = await this.has_permissions(); - //if (!permitted) return `permissions-required`; const position = await this.get_current_position(); return position; } catch (e) { };