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

Unsafe mode #19

Open
TwitchBronBron opened this issue May 22, 2024 · 0 comments
Open

Unsafe mode #19

TwitchBronBron opened this issue May 22, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@TwitchBronBron
Copy link
Member

TwitchBronBron commented May 22, 2024

Add an "unsafe" mode for promise observers where the internal try/catch is bypassed. It could look something like this:

  1. Make a new namespace called unsafe to house these functions
promises.unsafe.onThen()
promises.unsafe.onCatch()
promises.unsafe.onFinally()
promises.unsafe.chain()
  1. Add .unsafe() and .safe() to promises.chain() and promises.unsafe.chain() which flip the safety switch for that observer. Something like this:
promises.chain(somePromise).then(function()
    'i am safe
end function).unsafe().then(function()
    'i am unsafe
end function).then(function()
    'i am unsafe
end function).safe().then(function()
    'i am safe
end function)
  1. promises.unsafe.chain() and promises.safe.chain() are the same implementation, except the .unsafe one starts the chain with .unsafe mode enabled by default.
@TwitchBronBron TwitchBronBron added enhancement New feature or request help wanted Extra attention is needed labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant