Better errors
This commit is contained in:
parent
04b534b596
commit
ea15842113
1 changed files with 4 additions and 4 deletions
8
index.js
8
index.js
|
@ -109,7 +109,7 @@ module.exports.users = {
|
|||
rej(`Error when creating account: ${error.errors[0].msg} (${error.message})`);
|
||||
}
|
||||
}).catch((error) => {
|
||||
rej(`Error when sending request to ${api}: ${error.code}`);
|
||||
rej(`Error when sending request to ${api}: ${error.toString()}`);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -153,7 +153,7 @@ module.exports.users = {
|
|||
res(newUser);
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
rej(`Error when sending request to ${api}: ${error.code}`);
|
||||
rej(`Error when sending request to ${api}: ${error.toString()}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ module.exports.categories = {
|
|||
rej(`Error when creating category: ${data.message}`);
|
||||
}
|
||||
}).catch((error) => {
|
||||
rej(`Error when sending request to ${api}: ${error.code}`);
|
||||
rej(`Error when sending request to ${api}: ${error.toString()}`);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -213,7 +213,7 @@ module.exports.categories = {
|
|||
}
|
||||
res(data.categories);
|
||||
}).catch((error) => {
|
||||
rej(`Error while sending request to ${api}: ${error.code}`);
|
||||
rej(`Error while sending request to ${api}: ${error.toString()}`);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue