Skip to content

Add panic function #72

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

Merged
merged 5 commits into from
Mar 1, 2023
Merged

Add panic function #72

merged 5 commits into from
Mar 1, 2023

Conversation

glennsl
Copy link
Contributor

@glennsl glennsl commented Feb 25, 2023

panic is like failwith but raises a native JavaScript exception that gives a better stack trace and in-browser debugging experience.

@zth
Copy link
Collaborator

zth commented Feb 26, 2023

I typically don't use the exn functions, but is it problematic that we're changing what exn a bunch of functions is raising? I'm thinking about the case when people are actually relying on catching them.

Edit: oops, accidentally fat finger closed the PR...

@zth zth closed this Feb 26, 2023
@zth zth reopened this Feb 26, 2023
@glennsl
Copy link
Contributor Author

glennsl commented Feb 26, 2023

It should probably be noted as a breaking change, but these are all functions that have non-exception-raising alternatives. It doesn't really make sense to catch these exceptions, since you should then use the alternative non-exception-raising function instead (that definitely doesn't mean that people aren't still using it though).

@zth
Copy link
Collaborator

zth commented Feb 28, 2023

So, what about splitting this up, first adding the panic function, and then doing a separate discussion/PR on whether the current exn methods should use panic under the hood?

refactor(error): less magic needed

Co-authored-by: Christoph Knittel <[email protected]>

docs(error): panic fixes

Co-authored-by: Christoph Knittel <[email protected]>

docs(error): ReScript, not OCaml
@glennsl
Copy link
Contributor Author

glennsl commented Feb 28, 2023

So, what about splitting this up, first adding the panic function, and then doing a separate discussion/PR on whether the current exn methods should use panic under the hood?

Done. Internal use split out to #79

Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

Good stuff! @cknitt ?

@zth zth merged commit d7eac7f into rescript-lang:main Mar 1, 2023
@zth
Copy link
Collaborator

zth commented Mar 1, 2023

Thanks @glennsl !

@glennsl glennsl deleted the feat/panic branch March 1, 2023 17:58
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.

4 participants