diff --git a/include/Errors.hpp b/include/Errors.hpp index 42d67a9..7ba07f0 100644 --- a/include/Errors.hpp +++ b/include/Errors.hpp @@ -87,10 +87,9 @@ protected: std::string filename="" ) noexcept : ErrorBase(code, msg, line, filename) { std::string what_msg(trace.what()); - std::string::size_type newline_pos = what_msg.find("\n"); - while(newline_pos != std::string::npos) { + std::string::size_type newline_pos=-1; + while((newline_pos=what_msg.find("\n", newline_pos+1))!= std::string::npos) { what_msg.replace(newline_pos, 1, "\n "); - newline_pos = what_msg.find("\n", newline_pos+1); } _msg += "\n Trace: " + what_msg; }