Catch exception ValueError in number conversions