Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assertions for required parameters #14

Merged
merged 1 commit into from
Jun 22, 2024
Merged

feat: assertions for required parameters #14

merged 1 commit into from
Jun 22, 2024

Conversation

Manason
Copy link
Contributor

@Manason Manason commented Jun 22, 2024

Changes error handling of incorrect specification to assertions instead of errors as values.

Copy link
Contributor

@artur-michalak artur-michalak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change?

@solareon
Copy link
Contributor

Why the change?

why many code when few code do trick

@solareon solareon merged commit 903c4f6 into main Jun 22, 2024
4 checks passed
@solareon solareon deleted the assertions branch June 22, 2024 16:47
@Manason
Copy link
Contributor Author

Manason commented Jun 22, 2024

Why the change?

We want to fail loudly when spec isn't being followed. Errors as values fail silently, and are for errors that the client needs to handle. In this case, the fault is with the client, so the client wouldn't handle this error, rather they would fix themselves.

Even though lua is interpreted, a good rule of thumb is assertions are for issues that could be caught at "compile" time, whereas errors as values are for runtime issues caused by the state of the system or user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants