Trade-offs: exceptions keep the happy path clean and cost nothing until thrown, but a throw is slow and some projects compile with -fno-exceptions. Error codes and expected are explicit and predictable, but must be checked and propagated by hand.
In practice: follow the codebase. In new code, throw for rare, environmental failures and use std::expected for expected outcomes on hot or exception-free paths. Use optional for absence, never for errors that need a reason. Catch by const reference.
std::stoi throws std::invalid_argument or std::out_of_range, and accepts trailing garbage ("80abc" gives 80). std::from_chars never throws and also stops at the first character it cannot use ("80abc" gives 80 with ptr at 'a'), so check ptr against the end to reject trailing text.
With -fno-exceptions (common in games and embedded code) a throw is a compile error or an abort, depending on the toolchain; error codes and std::expected are the only options there.
std::expected needs C++23 and a recent standard library: libstdc++ 12, libc++ 16 or MSVC 19.33 or later.