-
Notifications
You must be signed in to change notification settings - Fork 14
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
throw error when before middleware returns undefined #49
Comments
Is not a bad idea, I think we can add a warning at least. We can consider same for |
Yup, I've been thinking about warnings. I don't know if We could try something similar to what React does with |
Yeah, I don't think that throwing is the way to go. A warning sounds good, but just for a dev build like @gillchristian suggested. The thing is that if we do it, we should do it for all functionalities, cause users that use this dev build will expect warnings for all functionalities used in a wrong way. |
Makes sense, I like the idea, will improve devs experience and is a way to guide new devs how to use the lib. I would like to start working on this. |
@gillchristian is there a usecase when returning |
(*) Let's consider the next case: const noOp = () => {}
const overwriteConf = () => ({
headers: { 'Content-Type': 'application/json' }
mode: 'no-cors'
})
trae.before(noOp)
trae.before(overwriteConf)
|
It would be nice if we dont even have statements like the following in the prod bundle. if (process.env.NODE_ENV !== 'production') {
// check and do some warnings
} |
I'd think this would be safer for most programmers who are like me and forget the return
The text was updated successfully, but these errors were encountered: