your function doesn't return anything in this code path.
we try to do error handeling first, keeps code cleaner.
please invert this logic.