mrbbot / slshx

⚔️ Strongly-typed Discord commands on Cloudflare Workers
MIT License
211 stars 8 forks source link

Add a better error when setDescription isn't called #2

Closed SkyfallWasTaken closed 2 years ago

SkyfallWasTaken commented 2 years ago

Right now, if you don't call setDescription, your command will error with this:

Unhandled Promise Rejection: APIError [400]: {
  "code": 50035,
  "errors": {
    "description": {
      "_errors": [
        {
          "code": "BASE_TYPE_REQUIRED",
          "message": "This field is required"
        }
      ]
    }
  },
  "message": "Invalid Form Body"
}
    at call (E:\projects\hmm\node_modules\.pnpm\slshx@0.2.0\node_modules\slshx\src\api\helpers.ts:92:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at deployCommands (E:\projects\hmm\node_modules\.pnpm\slshx@0.2.0\node_modules\slshx\src\commands\deploy.ts:55:5)

Slshx should error with something like Command must have a description! instead.

mrbbot commented 2 years ago

Hey! 👋 Just released slshx 0.3.0 including this fix. 🙂