aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r--src/libutil/error.hh26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index 6fe5e4857..d55e1d701 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -61,16 +61,16 @@ typedef enum {
// the lines of code surrounding an error.
struct LinesOfCode {
- std::optional<string> prevLineOfCode;
- std::optional<string> errLineOfCode;
- std::optional<string> nextLineOfCode;
+ std::optional<std::string> prevLineOfCode;
+ std::optional<std::string> errLineOfCode;
+ std::optional<std::string> nextLineOfCode;
};
// ErrPos indicates the location of an error in a nix file.
struct ErrPos {
int line = 0;
int column = 0;
- string file;
+ std::string file;
FileOrigin origin;
operator bool() const
@@ -80,7 +80,7 @@ struct ErrPos {
// convert from the Pos struct, found in libexpr.
template <class P>
- ErrPos& operator=(const P &pos)
+ ErrPos & operator=(const P & pos)
{
origin = pos.origin;
line = pos.line;
@@ -94,7 +94,7 @@ struct ErrPos {
}
template <class P>
- ErrPos(const P &p)
+ ErrPos(const P & p)
{
*this = p;
}
@@ -107,15 +107,15 @@ struct Trace {
struct ErrorInfo {
Verbosity level;
- string name; // FIXME: rename
+ std::string name; // FIXME: rename
hintformat msg;
std::optional<ErrPos> errPos;
std::list<Trace> traces;
- static std::optional<string> programName;
+ static std::optional<std::string> programName;
};
-std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool showTrace);
+std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool showTrace);
/* BaseError should generally not be caught, as it has Interrupted as
a subclass. Catch Error instead. */
@@ -124,8 +124,8 @@ class BaseError : public std::exception
protected:
mutable ErrorInfo err;
- mutable std::optional<string> what_;
- const string& calcWhat() const;
+ mutable std::optional<std::string> what_;
+ const std::string & calcWhat() const;
public:
unsigned int status = 1; // exit status
@@ -162,11 +162,11 @@ public:
const char * what() const noexcept override { return calcWhat().c_str(); }
#endif
- const string & msg() const { return calcWhat(); }
+ const std::string & msg() const { return calcWhat(); }
const ErrorInfo & info() const { calcWhat(); return err; }
template<typename... Args>
- BaseError & addTrace(std::optional<ErrPos> e, const string &fs, const Args & ... args)
+ BaseError & addTrace(std::optional<ErrPos> e, const std::string & fs, const Args & ... args)
{
return addTrace(e, hintfmt(fs, args...));
}