Closed
Description
I've haven't given this a lot of deep though so I'll probably someday want this post erased from the internet, but a few times already I've screwed up my 'constants',
You can see in the below example, if I misspell ACCRUE either here or in the constants file (I'm not even sure if its spelled correctly here), it becomes undefined and then the reducer happily uses the default switch, and because store.dispatch is inclined to put whatever it pleases (@@init/etc) through the default path, I can't use that to catch screw ups. Why not throw an exception when a falsey action.type is dispatched, since its so easy to do and sometimes difficult to catch, even in tests.
switch ( action.type ) {
case constants.AUTH_TOKEN:
return authenticate(state, action)
case constants.ACCRUE:
return accrue(state, action)
default:
return state
}