Enum mismatch issue

Options
lixia
lixia Unconfirmed, Member
edited October 2023 in ❓Other questions

How do you deal with a case where the value being passed in does not match the enums?

e.g. accepted enums = Apple, Grape. Value = Watermelon.

In this case, I want to escape the edit and move onto the next iteration in the loop.

Answers

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hey @lixia! This might be a good use case for try/ catch. Try/catch enables you to catch any errors that may occur in a specific stack of functions and execute additional logic based on that result. You can check out the docs here. Let me know if this helps! 😊