r-Techsupport / TuringBot

A scaleable Discord bot, built as a replacement for https://github.com/r-Techsupport/TechSupportBot
GNU Affero General Public License v3.0
1 stars 3 forks source link

Add protections for module files that don't have exports #20

Closed Cpt-Dingus closed 1 year ago

Cpt-Dingus commented 1 year ago

This should return some kind of a "Failed to load file" message or something instead of the current, unhandled error


node --enable-source-maps ./target/core/main.js 
|24/08/2023, 18:47:36| [II] core: Starting...
|24/08/2023, 18:47:37| [II] core: Initialized Discord connection
node:events:492
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'name')
    at generateSlashCommandForModule (C:\Users\Meti\Documents\TuringBot\src\core\slash_commands.ts:101:21)
    at Client.<anonymous> (C:\Users\Meti\Documents\TuringBot\src\core\main.ts:45:27)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:395:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v18.17.0
make: *** [Makefile:22: start] Error 1```