I like to use Ecto.UUID.cast(uuid) (rather than using regexes or whatever) to test if it’s a valid UUID before handing it to Repo.get or the like. If it’s not valid then I return an {:error, :invalid_uuid} tuple from the context function then decide how to surface it to the user (or Rollbar or whatever) in the caller. This way the app doesn’t “blow up” but you can gracefully handle it.


















