fully implemented error handling for challenge 1
This commit is contained in:
1 parent
8166245ab1
commit
5e2ac94212
1 file changed
+10
-2
@@ -69,10 +69,18 @@ async function getLatestExchange(position) {
|
|||||||
let lon = position.coords.longitude;
|
let lon = position.coords.longitude;
|
||||||
const res = await fetch(`/exRates/${lat}/${lon}`);
|
const res = await fetch(`/exRates/${lat}/${lon}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(err) {
|
function error(err) {
|
||||||
console.error("Geolocation error: ", err);
|
const data = {
|
||||||
|
data: {
|
||||||
|
message: "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
update(data);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user