covered daemon 500 code errors
This commit is contained in:
parent
610951fe99
commit
bb5e67ade5
4 changed files with 13 additions and 15 deletions
|
@ -46,8 +46,8 @@ function getClaimWithUri(uri, resolve, reject){
|
|||
).then(function (getUriResponse) {
|
||||
console.log(">> 'get claim' success...");
|
||||
//check to make sure the daemon didn't just time out
|
||||
if (getUriResponse.data.result.error === "Timeout"){
|
||||
reject("get request to lbry daemon timed out");
|
||||
if (getUriResponse.data.result.error){
|
||||
reject(getUriResponse.data.result.error);
|
||||
}
|
||||
console.log(">> response data:", getUriResponse.data);
|
||||
console.log(">> dl path =", getUriResponse.data.result.download_path)
|
||||
|
@ -57,7 +57,7 @@ function getClaimWithUri(uri, resolve, reject){
|
|||
*/
|
||||
resolve(getUriResponse.data.result.download_path);
|
||||
}).catch(function(getUriError){
|
||||
console.log(">> 'get' error:", getUriError);
|
||||
console.log(">> 'get' error.");
|
||||
// reject the promise with an error message
|
||||
reject(getUriError);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//var fs = require('fs');
|
||||
var fs = require('fs');
|
||||
var lbryApi = require('../helpers/lbryApi.js');
|
||||
|
||||
function handlePublishError(error) {
|
||||
|
@ -26,10 +26,10 @@ function createPublishParams(name, filepath, license, nsfw) {
|
|||
};
|
||||
return publishParams;
|
||||
}
|
||||
function deleteTemporaryFile(filepath, name){
|
||||
fs.unlink(filepath, function(err){
|
||||
function deleteTemporaryFile(filepath) {
|
||||
fs.unlink(filepath, function(err) {
|
||||
if (err) throw err;
|
||||
console.log('successfully deleted ' + name);
|
||||
console.log('successfully deleted ' + filepath);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,12 @@ module.exports = {
|
|||
.then(function(data){
|
||||
console.log("publish promise success. Tx info:", data)
|
||||
socket.emit("publish-complete", data);
|
||||
deleteTemporaryFile(filepath, name);
|
||||
deleteTemporaryFile(filepath);
|
||||
})
|
||||
.catch(function(error){
|
||||
console.log("error:", error);
|
||||
socket.emit("publish-status", handlePublishError(error));
|
||||
deleteTemporaryFile(filepath, name);
|
||||
deleteTemporaryFile(filepath);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -10,10 +10,10 @@ var queueApi = require('../helpers/queueApi.js');
|
|||
function handleRequestError(error, res) {
|
||||
if ((error === "NO_CLAIMS") || (error === "NO_FREE_PUBLIC_CLAIMS")){
|
||||
res.status(307).sendFile(path.join(__dirname, '../public', 'noClaims.html'));
|
||||
} else if (error === "Invalid URI") {
|
||||
res.status(400).sendFile(path.join(__dirname, '../public', 'invalidUri.html'));
|
||||
} else if (error.response.status === 500) {
|
||||
res.status(400).send(error.response.data.error.message);
|
||||
} else {
|
||||
res.status(400).send(error);
|
||||
res.status(400).send(error.toString());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
module.exports = function(app) {
|
||||
var http = require('http').Server(app);
|
||||
var io = require('socket.io')(http);
|
||||
var fs = require('fs');
|
||||
//var fs = require('fs');
|
||||
var path = require('path');
|
||||
var lbryApi = require('../helpers/lbryApi.js');
|
||||
var queueApi = require('../helpers/queueApi.js');
|
||||
var siofu = require("socketio-file-upload");
|
||||
var socketHelpers = require('../helpers/socketHelpers.js');
|
||||
|
||||
|
|
Loading…
Reference in a new issue