We want to catch logic_error instead of std::out_of_range when dealing with stoll.
This is because stoll may throw two different errors:
- https://en.cppreference.com/w/cpp/error/invalid_argument
- https://en.cppreference.com/w/cpp/error/out_of_range
Both of them inherit from logic_error https://en.cppreference.com/w/cpp/error/logic_error