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