Skip to content
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

How to Handle error "No StateMachineInput found with name" #318

Open
harisAsterbyte opened this issue Mar 8, 2024 · 3 comments
Open

How to Handle error "No StateMachineInput found with name" #318

harisAsterbyte opened this issue Mar 8, 2024 · 3 comments

Comments

@harisAsterbyte
Copy link

I attempted to change the state using the following code:
riveFile?.fireState("GirlState", "input")

In my scenario, inputs are received from the server side. However, some of these state inputs are not present in the Rive file. As a result, a crash occurs with the following error:

app.rive.runtime.kotlin.core.errors.StateMachineInputException: No StateMachineInput found with name input
How can I handle this situation.

@umberto-sonnino
Copy link
Contributor

Hi @harisAsterbyte, here are a couple of potential solutions:

  • Simply catch the exception when you're making the API call
  • Alternatively, you can query the inputs via girlStateMachine.inputNames() and skip an specific input when that state machine doesn't have it

@harisAsterbyte
Copy link
Author

@umberto-sonnino looking for second solution.
can you give me the detail solution based on this code riveFile?.fireState("GirlState", "input")

@umberto-sonnino
Copy link
Contributor

@umberto-sonnino looking for second solution. can you give me the detail solution based on this code riveFile?.fireState("GirlState", "input")

I don't know much about your setup, but you can take a look at our tests to see how to grab the right references and adapt them to your use case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants