Testing error status on db.get().
This commit is contained in:
parent
b7e1a318a8
commit
aea83fac5d
|
@ -70,9 +70,13 @@ export const appendTrkpt = async (db: any, trkpt: any) => {
|
||||||
track = result;
|
track = result;
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
console.log(`db.get(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
if (error.status='404') {
|
||||||
track = initialTrack;
|
track = initialTrack;
|
||||||
});
|
} else {
|
||||||
|
console.log(`db.get(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
|
alert(`db.get(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
track.metadata.lastModified = trkpt.time;
|
track.metadata.lastModified = trkpt.time;
|
||||||
const currentTrkseg = track.track.trk.at(-1).trkseg.at(-1);
|
const currentTrkseg = track.track.trk.at(-1).trkseg.at(-1);
|
||||||
currentTrkseg.trkpt.push(trkpt);
|
currentTrkseg.trkpt.push(trkpt);
|
||||||
|
@ -82,5 +86,6 @@ export const appendTrkpt = async (db: any, trkpt: any) => {
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
console.log(`db.put(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
console.log(`db.put(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
|
alert(`db.put(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue