File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
lib/ReactViews/Map/MapNavigation/Items Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 44
55- Explicitly set prettier tab-width
66- Move release guide from README.md to RELEASE_GUIDE.md
7+ - Enhanced error processing for obtaining user location
78- [ The next improvement]
89
910#### 8.7.10 - 2024-11-29
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ export class MyLocation extends MapNavigationItemController {
153153 } ) ;
154154 }
155155
156- handleLocationError ( err : any ) {
156+ handleLocationError ( err : GeolocationPositionError ) {
157157 const t = i18next . t . bind ( i18next ) ;
158158 let message = err . message ;
159159 if ( message && message . indexOf ( "Only secure origins are allowed" ) === 0 ) {
@@ -162,12 +162,19 @@ export class MyLocation extends MapNavigationItemController {
162162 const uri = new URI ( window . location ) ;
163163 const secureUrl = uri . protocol ( "https" ) . toString ( ) ;
164164 message = t ( "location.originError" , { secureUrl : secureUrl } ) ;
165+ } else if ( err . code === err . PERMISSION_DENIED ) {
166+ message = t ( "location.permissionDenied" ) ;
167+ } else if ( err . code === err . POSITION_UNAVAILABLE ) {
168+ message = t ( "location.positionUnavailable" ) ;
169+ } else if ( err . code === err . TIMEOUT ) {
170+ message = t ( "location.timeout" ) ;
165171 }
166172 this . terria . raiseErrorToUser (
167173 new TerriaError ( {
168174 sender : this ,
169175 title : t ( "location.errorGettingLocation" ) ,
170- message : message
176+ message : message ,
177+ showDetails : false
171178 } )
172179 ) ;
173180 }
Original file line number Diff line number Diff line change 6363 "myLocation" : " My Location" ,
6464 "location" : " Location" ,
6565 "originError" : " Your browser can only provide your location when using HTTPS. You may be able to use {{secureUrl}} instead." ,
66- "centreMap" : " Centre map at your current location"
66+ "centreMap" : " Centre map at your current location" ,
67+ "permissionDenied" : " Permission denied to get your location. Please check your browser settings." ,
68+ "positionUnavailable" : " Your location information is unavailable." ,
69+ "timeout" : " Obtaining your location information took to long. Please try again later."
6770 },
6871 "splitterTool" : {
6972 "errorTitle" : " Failed to compare catalog item." ,
You can’t perform that action at this time.
0 commit comments