Skip to content

Commit c156a2a

Browse files
authored
Error logging
1 parent ae1b36f commit c156a2a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mega.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function streamToBuffer(stream) {
1111
stream.on('data', chunk => chunks.push(chunk));
1212
stream.on('end', () => resolve(Buffer.concat(chunks)));
1313
stream.on('error', err => {
14-
console.error('Error stream:', err);
14+
console.error('Error creating stream:', err);
1515
reject(err);
1616
});
1717
});
@@ -29,7 +29,7 @@ function fullUpload(upstream) {
2929
});
3030
});
3131
upstream.on('error', err => {
32-
console.error('Error in upload:', err);
32+
console.error('Couldnt upload media:', err);
3333
reject(err);
3434
});
3535
});
@@ -65,11 +65,11 @@ class Client {
6565
lock: new Mutex()
6666
});
6767
} catch (e) {
68-
console.error('Error setting up storage for', acct.email, e);
68+
console.error(`Error setting up storage for: ${acct.email}\nError: ${e}\nPossible serverless storage config issue. Check temp storage env.`);
6969
}
7070
}
7171
if (this.accounts.length === 0) {
72-
throw new Error('No account could be setup successfully');
72+
throw new Error('No account could be setup successfully at least need one account');
7373
}
7474
}
7575

@@ -88,11 +88,11 @@ class Client {
8888
var account;
8989
if (mode === 'dual' && query && query.email) {
9090
account = this.getAcc(query.email);
91-
if (!account) throw new Error('Account ' + query.email + ' not found');
91+
if (!account) throw new Error('Account:' + query.email + ' not found or banned');
9292
} else {
9393
account = this.getZeroAcc();
9494
}
95-
if (!account || !account.storage) throw new Error('Storage not available for this account');
95+
if (!account || !account.storage) throw new Error('Storage not available for this account payment required or forbidden');
9696
var release = await account.lock.acquire();
9797
try {
9898
if (config.storage === 'file') {
@@ -130,7 +130,7 @@ class Client {
130130

131131
async getFile(filePath) {
132132
var primary = this.getZeroAcc();
133-
if (!primary) throw new Error('No account available');
133+
if (!primary) throw new Error('No account available at least need one account');
134134
var file = Object.values(primary.storage.files).find(f => f.name === path.basename(filePath));
135135
if (!file) throw new Error('File not found');
136136
return file;

0 commit comments

Comments
 (0)