Skip to content

Commit

Permalink
Improve source output
Browse files Browse the repository at this point in the history
* Though the exact error may be unknown, as far as the user is concerned
"unknown error" is confusing; specify at the least that it is definitely a
source error.
* Put newlines in the proper locations so that the end of the stack trace and
the beginning of the summary are not on the same line.
  • Loading branch information
garfieldnate committed Aug 14, 2024
1 parent 80c804c commit ca9cad7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Core/CLI/src/cli_CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ bool CommandLineInterface::SetError(const std::string& error)
m_Result << std::endl;
}
m_Result << error;
m_Result << std::endl;
m_LastError = error;
return false;
}
Expand All @@ -454,6 +455,7 @@ bool CommandLineInterface::AppendError(const std::string& error)
m_Result << std::endl;
}
m_Result << error;
m_Result << std::endl;
m_LastError.append(error);
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions Core/CLI/src/cli_load_save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ bool CommandLineInterface::Source(const char* buffer, bool printFileStack)
if (printFileStack)
{
std::string temp;
sourceError.append("\n\t");
sourceError.append("\t");
sourceError.append(m_SourceFileStack.top());
sourceError.append(":");
sourceError.append(to_string(line, temp));
Expand All @@ -927,10 +927,11 @@ bool CommandLineInterface::Source(const char* buffer, bool printFileStack)
sourceError.append(":");
sourceError.append(to_string(line, temp));
}
sourceError.append("\n");
}
if (sourceError.empty()) {
// It's important that we don't return an empty error string, as that will be interpreted as success
sourceError = "Unknown error";
sourceError = "Error while sourcing file";
}
AppendError(sourceError);
return false;
Expand Down

0 comments on commit ca9cad7

Please sign in to comment.