mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
Fix resolveBuffer file failure behaviour
This commit is contained in:
committed by
GitHub
parent
ec1ed15c88
commit
b91f8f27be
@@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user