forge42dev / remix-toast

Server side implementation of toast notifications in Remix
MIT License
190 stars 11 forks source link

Cannot throw instead of return #29

Closed kenn closed 1 month ago

kenn commented 1 month ago

In other words,

throw redirect('/')

works but

throw redirectWithError('/', 'Error!')

does not work. Is this a known limitation?

Using unstable_singleFetch: true

AlemTuzlak commented 1 month ago

@kenn you should await when you throw, eg. throw await redirectWithError("/", "Error!")

kenn commented 1 month ago

ooh, missed it in a plain sight 😅 thank you!