Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 7883675

Browse files
committed
Better exception messages
1 parent ba2ccb6 commit 7883675

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/csstransitionstate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function reduce(
162162
nextState = appearPendingState(props);
163163
break;
164164
default:
165-
throw new Error("invalid state transition");
165+
throw new Error(`invalid state transition from ${StateID[state.id]}`);
166166
};
167167
return { state: nextState, pending: ActionID.TransitionTrigger };
168168
case ActionID.TransitionStart:
@@ -191,7 +191,7 @@ export function reduce(
191191
if (props.onTransitionComplete) { props.onTransitionComplete(); }
192192
return { state: defaultState(props) };
193193
default:
194-
throw new Error("invalid state transition");
194+
throw new Error(`invalid state transition from ${StateID[state.id]}`);
195195
}
196196
case ActionID.TransitionTrigger:
197197
switch (state.id) {
@@ -228,7 +228,7 @@ export function reduce(
228228
case StateID.LeaveStarted:
229229
return { state: enterStartedState(props) };
230230
default:
231-
throw new Error("invalid state transition");
231+
throw new Error(`invalid state transition from ${StateID[state.id as any]}`);
232232
}
233233
default:
234234
}

0 commit comments

Comments
 (0)