Use std::error_code for error messages