blank line before `else` :-s
also, I'd rather have the error case as 'else' branch and the loop case as 'then' branch.