mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-27 23:46:34 +01:00
* fix JSON parse error when device is offline (#111) * add 503 error and fix makeRequest mixin when device is Offline or Service is unavailable * add 503 error and fix makeRequest mixin when device is Offline or Service is unavailable * version bump Co-authored-by: Luigui Delyer <git@s1x.com.br>
24 lines
805 B
JavaScript
24 lines
805 B
JavaScript
const errors = {
|
|
400: 'Parameter error',
|
|
401: 'Wrong account or password',
|
|
402: 'Email inactivated',
|
|
403: 'Forbidden',
|
|
404: 'Device does not exist',
|
|
406: 'Authentication failed',
|
|
503: 'Service Temporarily Unavailable or Device is offline'
|
|
};
|
|
|
|
const customErrors = {
|
|
ch404: 'Device channel does not exist',
|
|
unknown: 'An unknown error occurred',
|
|
noDevices: 'No devices found',
|
|
noPower: 'No power usage data found',
|
|
noSensor: "Can't read sensor data from device",
|
|
noFirmware: "Can't get model or firmware version",
|
|
invalidAuth: 'Library needs to be initialized using email and password',
|
|
invalidCredentials: 'Invalid credentials provided',
|
|
invalidPowerState: 'Invalid power state. Expecting: "on", "off" or "toggle"',
|
|
};
|
|
|
|
module.exports = Object.assign(errors, customErrors);
|