refactor: use constexpr and remove template
Summary:
Minor follow-up to core#19845 (D10720).
The template was thought to be needed to handle both std::ios_base::failure and std::runtime_error, but they both inherit std:eexception so it is not necessary.
This is a backport of core#20033
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10732