class BuildErrorPrinter
{
public:
- BuildErrorPrinter(const SBuf &anInputLocation, int aPage, const char *aMsg, const char *aNear): inputLocation(anInputLocation), page_id(aPage), msg(aMsg), near(aNear) {}
+ BuildErrorPrinter(const SBuf &anInputLocation, int aPage, const char *aMsg, const char *anErrorLocation):
+ inputLocation(anInputLocation),
+ page_id(aPage),
+ msg(aMsg),
+ errorLocation(anErrorLocation)
+ {}
/// reports error details (for admin-visible exceptions and debugging)
std::ostream &print(std::ostream &) const;
const SBuf &inputLocation;
const int page_id;
const char *msg;
- const char *near;
+ const char *errorLocation;
};
static inline std::ostream &
/// react to a compile() error
/// \param msg description of what went wrong
-/// \param near approximate start of the problematic input
+/// \param errorLocation approximate start of the problematic input
/// \param forceBypass whether detection of this error was introduced late,
/// after old configurations containing this error could have been
/// successfully validated and deployed (i.e. the admin may not be
/// able to fix this newly detected but old problem quickly)
void
-ErrorState::noteBuildError_(const char *msg, const char *near, const bool forceBypass)
+ErrorState::noteBuildError_(const char *const msg, const char * const errorLocation, const bool forceBypass)
{
using ErrorPage::BuildErrorPrinter;
const auto runtime = !starting_up;
if (starting_up && seenErrors <= 10)
debugs(4, debugLevel, "WARNING: The following configuration error will be fatal in future Squid versions");
- debugs(4, debugLevel, "ERROR: " << BuildErrorPrinter(inputLocation, page_id, msg, near));
+ debugs(4, debugLevel, "ERROR: " << BuildErrorPrinter(inputLocation, page_id, msg, errorLocation));
} else {
- throw TexcHere(ToSBuf(BuildErrorPrinter(inputLocation, page_id, msg, near)));
+ throw TexcHere(ToSBuf(BuildErrorPrinter(inputLocation, page_id, msg, errorLocation)));
}
}
// TODO: Add support for prefix printing to Raw
const size_t maxContextLength = 15; // plus "..."
- if (strlen(near) > maxContextLength) {
- os.write(near, maxContextLength);
+ if (strlen(errorLocation) > maxContextLength) {
+ os.write(errorLocation, maxContextLength);
os << "...";
} else {
- os << near;
+ os << errorLocation;
}
// XXX: We should not be converting (inner) exception to text if we are
/// React to a compile() error, throwing if buildContext allows.
/// \param msg description of what went wrong
- /// \param near approximate start of the problematic input
- void noteBuildError(const char *msg, const char *near) {
- noteBuildError_(msg, near, false);
+ /// \param errorLocation approximate start of the problematic input
+ void noteBuildError(const char *const msg, const char * const errorLocation) {
+ noteBuildError_(msg, errorLocation, false);
}
/// Note a compile() error but do not throw for backwards
/// compatibility with older configurations that may have such errors.
/// Should eventually be replaced with noteBuildError().
/// \param msg description of what went wrong
- /// \param near approximate start of the problematic input
- void bypassBuildErrorXXX(const char *msg, const char *near) {
- noteBuildError_(msg, near, true);
+ /// \param errorLocation approximate start of the problematic input
+ void bypassBuildErrorXXX(const char *const msg, const char * const errorLocation) {
+ noteBuildError_(msg, errorLocation, true);
}
/**
HttpReplyPointer response_;
private:
- void noteBuildError_(const char *msg, const char *near, const bool forceBypass);
+ void noteBuildError_(const char *msg, const char *errorLocation, bool forceBypass);
static const SBuf LogformatMagic; ///< marks each embedded logformat entry
};