replaces fatalError with assertionFailure in 'changeState'

This commit is contained in:
Igor Kravchenko 2020-10-01 12:47:21 +03:00
parent 65fedb737e
commit c222234adc
1 changed files with 3 additions and 1 deletions

View File

@ -270,6 +270,7 @@ public class StateComponentMapping {
/// so that a fluent interface can be used when configuring entity states.
/// - Parameter type: The type of component to add a mapping to the state for
/// - Returns: The new ComponentMapping for that type
@discardableResult
public func add(_ type: ComponentInitializable.Type) -> StateComponentMapping {
creatingState.add(type)
}
@ -327,7 +328,8 @@ public class EntityStateMachine<StateName: Hashable> {
/// - Parameter name: The name of the state to change to.
public func changeState(name: StateName) {
guard let newState = states[name] else {
fatalError("Entity state '\(name)' doesn't exist")
assertionFailure("Entity state '\(name)' doesn't exist")
return
}
if newState === currentState {