Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

Validation errors reported by zod are not useful #64

@Fleny113

Description

@Fleny113

Issue description

Calling toJSON() from an instance of a SlashCommandBuilder without setting required parameters (name and description) throw an error that seem from zod that isn't useful at all to understand the problem because of the size of the error and don't say what parameter is missing.

Original message:
When creating a SlashCommandBuilder and doing toJSON() zod thrown about an recived undefined and expect a string.

Step to reproduce:

  1. Import SlashCommandBuilder from @discordjs/builders
  2. Create a new Builder and call toJSON()
  3. zod should throw an error that isn't useful at all

zodError.log

Code sample

import { SlashCommandBuilder } from "@discordjs/builders";
new SlashCommandBuilder().setName("test").toJSON();

@discordjs/builders version

0.9.0

Node.js version

node.js v17.2.0 | Typescript 4.5.4

Operating system

Windows 11

Priority this issue should have

High (immediate attention needed)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions