mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
showtrace as function arg
This commit is contained in:
parent
bc9e87412c
commit
ef24a0835d
2 changed files with 7 additions and 5 deletions
|
@ -34,7 +34,7 @@ const string& BaseError::calcWhat() const
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<string> ErrorInfo::programName = std::nullopt;
|
std::optional<string> ErrorInfo::programName = std::nullopt;
|
||||||
bool ErrorInfo::showTrace = false;
|
// bool ErrorInfo::showTrace = false;
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &os, const hintformat &hf)
|
std::ostream& operator<<(std::ostream &os, const hintformat &hf)
|
||||||
{
|
{
|
||||||
|
@ -211,7 +211,8 @@ void printAtPos(const string &prefix, const ErrPos &pos, std::ostream &out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo)
|
// std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo)
|
||||||
|
std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool showTrace)
|
||||||
{
|
{
|
||||||
auto errwidth = std::max<size_t>(getWindowSize().second, 20);
|
auto errwidth = std::max<size_t>(getWindowSize().second, 20);
|
||||||
string prefix = "";
|
string prefix = "";
|
||||||
|
@ -326,7 +327,7 @@ std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// traces
|
// traces
|
||||||
if (ErrorInfo::showTrace) {
|
if (showTrace) {
|
||||||
for (auto iter = einfo.traces.rbegin(); iter != einfo.traces.rend(); ++iter)
|
for (auto iter = einfo.traces.rbegin(); iter != einfo.traces.rend(); ++iter)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -107,10 +107,11 @@ struct ErrorInfo {
|
||||||
std::list<Trace> traces;
|
std::list<Trace> traces;
|
||||||
|
|
||||||
static std::optional<string> programName;
|
static std::optional<string> programName;
|
||||||
static bool showTrace;
|
// static bool showTrace;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo);
|
// std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo);
|
||||||
|
std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool showTrace);
|
||||||
|
|
||||||
/* BaseError should generally not be caught, as it has Interrupted as
|
/* BaseError should generally not be caught, as it has Interrupted as
|
||||||
a subclass. Catch Error instead. */
|
a subclass. Catch Error instead. */
|
||||||
|
|
Loading…
Reference in a new issue