mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
show trace of errors when using --show-trace
This commit is contained in:
parent
e37bca136e
commit
828cf7b058
1 changed files with 5 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include "get-drvs.hh"
|
#include "get-drvs.hh"
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "affinity.hh"
|
#include "affinity.hh"
|
||||||
|
#include "globals.hh"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
@ -108,6 +109,7 @@ NixRepl::NixRepl(const Strings & searchPath, nix::ref<Store> store)
|
||||||
|
|
||||||
void NixRepl::mainLoop(const Strings & files)
|
void NixRepl::mainLoop(const Strings & files)
|
||||||
{
|
{
|
||||||
|
string error = ANSI_RED "error:" ANSI_NORMAL " ";
|
||||||
std::cout << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
|
std::cout << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
|
||||||
|
|
||||||
for (auto & i : files)
|
for (auto & i : files)
|
||||||
|
@ -138,12 +140,12 @@ void NixRepl::mainLoop(const Strings & files)
|
||||||
// input without clearing the input so far.
|
// input without clearing the input so far.
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
printMsg(lvlError, "error: " + e.msg());
|
printMsg(lvlError, format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
|
||||||
}
|
}
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, "error: " + e.msg());
|
printMsg(lvlError, format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
|
||||||
} catch (Interrupted & e) {
|
} catch (Interrupted & e) {
|
||||||
printMsg(lvlError, "error: " + e.msg());
|
printMsg(lvlError, format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
// We handled the current input fully, so we should clear it and read brand new input.
|
// We handled the current input fully, so we should clear it and read brand new input.
|
||||||
|
|
Loading…
Reference in a new issue