2017-06-03 09:41:02 +02:00
|
|
|
module.exports = {
|
|
|
|
handleRequestError: function(error, res) {
|
|
|
|
if ((error === "NO_CLAIMS") || (error === "NO_FREE_PUBLIC_CLAIMS")){
|
2017-06-10 01:46:57 +02:00
|
|
|
res.status(307).render('noClaims');
|
2017-06-03 10:16:40 +02:00
|
|
|
} else if (error.response){
|
|
|
|
res.status(error.response.status).send(error.response.data.error.message);
|
|
|
|
} else if (error.code === "ECONNREFUSED") {
|
|
|
|
res.status(400).send("Connection refused. The daemon may not be running.");
|
2017-06-03 09:41:02 +02:00
|
|
|
} else {
|
|
|
|
res.status(400).send(error.toString());
|
|
|
|
};
|
2017-06-17 02:48:51 +02:00
|
|
|
},
|
|
|
|
handlePublishError: function(error) {
|
|
|
|
if (error.code === "ECONNREFUSED"){
|
|
|
|
return "Connection refused. The daemon may not be running.";
|
|
|
|
} else if (error.response.data.error) {
|
|
|
|
return error.response.data.error;
|
|
|
|
} else {
|
|
|
|
return error;
|
|
|
|
};
|
|
|
|
}
|
2017-06-03 09:41:02 +02:00
|
|
|
}
|