Androz2091 / discord-giveaways-bot

🎁Giveways Bot using the discord-giveaways package
ISC License
202 stars 167 forks source link

UnhandledPromiseRejectionWarning Error #59

Closed officialrolly closed 3 years ago

officialrolly commented 3 years ago

How can I fix this error? I got the errors while starting up the bot as well as starting giveaways. It doesn't show the giveaway embed up, only for the Giveaway started in channel.

(node:9292) UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted (Unexpected end of JSON input).
    at GiveawaysManager.getAllGiveaways (C:\Users\user\Desktop\giveaways-bot-master\node_modules\discord-giveaways\src\Manager.js:308:27)
    at async GiveawaysManager._init (C:\Users\user\Desktop\giveaways-bot-master\node_modules\discord-giveaways\src\Manager.js:391:30)
(node:9292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Thanks!

needhamgary commented 3 years ago

Make sure you have the proper ending in the storage location. Aka }

Nico105 commented 3 years ago

How can I fix this error? I got the errors while starting up the bot as well as starting giveaways. It doesn't show the giveaway embed up, only for the Giveaway started in channel.

(node:9292) UnhandledPromiseRejectionWarning: SyntaxError: The storage file is not properly formatted (Unexpected end of JSON input).
    at GiveawaysManager.getAllGiveaways (C:\Users\user\Desktop\giveaways-bot-master\node_modules\discord-giveaways\src\Manager.js:308:27)
    at async GiveawaysManager._init (C:\Users\user\Desktop\giveaways-bot-master\node_modules\discord-giveaways\src\Manager.js:391:30)
(node:9292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Thanks!

Do you still face this issue? If not, please provide your conclusion/solution and close this issue. If yes, have you made sure that inside your giveaways.json it starts with an [ and ends with an ]?