Catch attribute error if str