Adding error log messages.
This commit is contained in:
parent
20ae635d3f
commit
b7e1a318a8
|
@ -64,17 +64,23 @@ const initialTrack = {
|
||||||
|
|
||||||
export const appendTrkpt = async (db: any, trkpt: any) => {
|
export const appendTrkpt = async (db: any, trkpt: any) => {
|
||||||
var track: any;
|
var track: any;
|
||||||
await db.get(CURRENT_TRACK)
|
await db
|
||||||
|
.get(CURRENT_TRACK)
|
||||||
.then((result: any) => {
|
.then((result: any) => {
|
||||||
track = result;
|
track = result;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((error: any) => {
|
||||||
|
console.log(`db.get(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
track = initialTrack;
|
track = initialTrack;
|
||||||
});
|
});
|
||||||
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);
|
||||||
db.put(track).then((response: any) => {
|
db.put(track)
|
||||||
console.log(`db.put(track), response: ${JSON.stringify(response)}`);
|
.then((response: any) => {
|
||||||
});
|
console.log(`db.put(track), response: ${JSON.stringify(response)}`);
|
||||||
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
|
console.log(`db.put(CURRENT_TRACK), ERROR: ${JSON.stringify(error)}`);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue