add PositionNotFound
This commit is contained in:
parent
059b5d515a
commit
a9ff25c771
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;
|
||||
|
|
Loading…
Reference in New Issue