mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 12:40:50 +00:00
Fix resolveBuffer file failure behaviour
This commit is contained in:
parent
ec1ed15c88
commit
b91f8f27be
1 changed files with 3 additions and 2 deletions
|
|
@ -284,11 +284,12 @@ class ClientDataResolver {
|
||||||
} else {
|
} else {
|
||||||
const file = path.resolve(resource);
|
const file = path.resolve(resource);
|
||||||
fs.stat(file, (err, stats) => {
|
fs.stat(file, (err, stats) => {
|
||||||
if (err) reject(err);
|
if (err) return reject(err);
|
||||||
if (!stats || !stats.isFile()) throw new Error(`The file could not be found: ${file}`);
|
if (!stats || !stats.isFile()) return reject(new Error(`The file could not be found: ${file}`));
|
||||||
fs.readFile(file, (err2, data) => {
|
fs.readFile(file, (err2, data) => {
|
||||||
if (err2) reject(err2); else resolve(data);
|
if (err2) reject(err2); else resolve(data);
|
||||||
});
|
});
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue