Catch std::out_of_range exceptions in the substr modifier