fix: improve str exceptions and consistency with python (#3826) * Improve str exceptions * Revert macro change just in case * Make clang-tidy happy * Fix one more clang-tidy issue * Refactor duplicate method