mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +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 {
|
||||
const file = path.resolve(resource);
|
||||
fs.stat(file, (err, stats) => {
|
||||
if (err) reject(err);
|
||||
if (!stats || !stats.isFile()) throw new Error(`The file could not be found: ${file}`);
|
||||
if (err) return reject(err);
|
||||
if (!stats || !stats.isFile()) return reject(new Error(`The file could not be found: ${file}`));
|
||||
fs.readFile(file, (err2, data) => {
|
||||
if (err2) reject(err2); else resolve(data);
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue