Spaces:
Sleeping
Sleeping
Kuruva Laxmi commited on
Commit ·
aca4006
1
Parent(s): e219510
Update geolocation error handler to show specific browser errors
Browse files
client/src/pages/Search.jsx
CHANGED
|
@@ -64,8 +64,13 @@ const Search = () => {
|
|
| 64 |
console.error('Nearby fetch failed:', err);
|
| 65 |
setLocating(false);
|
| 66 |
}
|
| 67 |
-
}, () => {
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
setLocating(false);
|
| 70 |
});
|
| 71 |
};
|
|
|
|
| 64 |
console.error('Nearby fetch failed:', err);
|
| 65 |
setLocating(false);
|
| 66 |
}
|
| 67 |
+
}, (error) => {
|
| 68 |
+
console.error("Geolocation Error Details:", error);
|
| 69 |
+
let errorMsg = "Could not get your location.";
|
| 70 |
+
if (error.code === 1) errorMsg = "Location access was denied by the browser or iframe (Permission denied). Try opening the direct app link without the Hugging Face wrapper.";
|
| 71 |
+
if (error.code === 2) errorMsg = "Position unavailable. The network is down or the position calculation failed.";
|
| 72 |
+
if (error.code === 3) errorMsg = "The request to get your location timed out.";
|
| 73 |
+
alert(errorMsg + "\n\nBrowser Error: " + error.message);
|
| 74 |
setLocating(false);
|
| 75 |
});
|
| 76 |
};
|