mirror of
https://github.com/franjsco/trackmyd-bot
synced 2025-06-05 22:19:29 +02:00
add PositionNotFound
This commit is contained in:
7
api.js
7
api.js
@@ -53,7 +53,12 @@ function getInfoDevice(deviceId) {
|
||||
|
||||
return res.json();
|
||||
})
|
||||
.then(json => json)
|
||||
.then((json) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(json, 'position')) {
|
||||
throw new Error('PositionNotFound');
|
||||
}
|
||||
return json;
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.logError(err);
|
||||
return err;
|
||||
|
@@ -97,6 +97,11 @@ function devicesNotFound(data) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
function positionNotFound() {
|
||||
const msg = 'Position not found';
|
||||
return msg;
|
||||
}
|
||||
|
||||
module.exports.unauthorizedUser = unauthorizedUser;
|
||||
module.exports.welcome = welcome;
|
||||
module.exports.help = help;
|
||||
@@ -107,3 +112,4 @@ module.exports.addDeviceHeader = addDeviceHeader;
|
||||
module.exports.addDeviceBody = addDeviceBody;
|
||||
module.exports.error = error;
|
||||
module.exports.devicesNotFound = devicesNotFound;
|
||||
module.exports.positionNotFound = positionNotFound;
|
||||
|
Reference in New Issue
Block a user