mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
fix(Util): reject with a meaningful error instead of throwing one
This commit is contained in:
@@ -271,7 +271,7 @@ class ClientDataResolver {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (resource.pipe && typeof resource.pipe === 'function') {
|
} else if (resource && resource.pipe && typeof resource.pipe === 'function') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const buffers = [];
|
const buffers = [];
|
||||||
resource.once('error', reject);
|
resource.once('error', reject);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class TextBasedChannel {
|
|||||||
if (options.files) {
|
if (options.files) {
|
||||||
for (let i = 0; i < options.files.length; i++) {
|
for (let i = 0; i < options.files.length; i++) {
|
||||||
let file = options.files[i];
|
let file = options.files[i];
|
||||||
if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };
|
if (!file || typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };
|
||||||
if (!file.name) {
|
if (!file.name) {
|
||||||
if (typeof file.attachment === 'string') {
|
if (typeof file.attachment === 'string') {
|
||||||
file.name = path.basename(file.attachment);
|
file.name = path.basename(file.attachment);
|
||||||
|
|||||||
Reference in New Issue
Block a user