summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-06-12 12:50:28 +0200
committerArne Juul <arnej@yahoo-inc.com>2018-06-12 13:51:45 +0200
commit016e584f0ad5a071e13d75eb8ad5ddb46b8c54f5 (patch)
tree869d4e4a4c4b8a9f9ef691b2980009017dece9e6 /document
parent22796dddd3dc025018093783328ac87535ffecd9 (diff)
use LOG_ABORT not just abort()
* abort() has the unfortunate effect that nothing is seen in the log, just an event (which is usually not displayed); so ops people don't see that the program is crashing at all. * LOG_ABORT("message") will log an error with the message (and the file and line) before calling abort(), so it's easy to see what happened. * add or move <vespa/log/log.h> include and LOG_SETUP lines before LOG_ABORT is used (or included).
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/base/globalid.cpp5
-rw-r--r--document/src/vespa/document/datatype/primitivedatatype.cpp7
-rw-r--r--document/src/vespa/document/repo/document_type_repo_factory.cpp5
-rw-r--r--document/src/vespa/document/select/result.h5
4 files changed, 16 insertions, 6 deletions
diff --git a/document/src/vespa/document/base/globalid.cpp b/document/src/vespa/document/base/globalid.cpp
index 354e6ce67aa..5211647e848 100644
--- a/document/src/vespa/document/base/globalid.cpp
+++ b/document/src/vespa/document/base/globalid.cpp
@@ -7,6 +7,9 @@
#include <vespa/vespalib/stllike/hash_set.hpp>
#include <cassert>
+#include <vespa/log/log.h>
+LOG_SETUP(".document.base.globalid");
+
namespace {
bool
@@ -29,7 +32,7 @@ getHexVal(char c)
return (c - 'A' + 10);
}
assert(validateHex(c));
- abort();
+ LOG_ABORT("should not be reached");
}
}
diff --git a/document/src/vespa/document/datatype/primitivedatatype.cpp b/document/src/vespa/document/datatype/primitivedatatype.cpp
index fef0e532e44..aa8879e299e 100644
--- a/document/src/vespa/document/datatype/primitivedatatype.cpp
+++ b/document/src/vespa/document/datatype/primitivedatatype.cpp
@@ -6,6 +6,9 @@
#include <vespa/vespalib/util/stringfmt.h>
#include <sstream>
+#include <vespa/log/log.h>
+LOG_SETUP(".document.datatype.primitivedatatype");
+
namespace document {
IMPLEMENT_IDENTIFIABLE_ABSTRACT(PrimitiveDataType, DataType);
@@ -64,10 +67,10 @@ PrimitiveDataType::createFieldValue() const
case T_BYTE: return FieldValue::UP(new ByteFieldValue);
case T_PREDICATE: return FieldValue::UP(new PredicateFieldValue);
case T_TENSOR: return std::make_unique<TensorFieldValue>();
- abort();
+ LOG_ABORT("should not be reached");
}
assert(!"getId() returned value out of range");
- abort();
+ LOG_ABORT("should not be reached");
}
void
diff --git a/document/src/vespa/document/repo/document_type_repo_factory.cpp b/document/src/vespa/document/repo/document_type_repo_factory.cpp
index 208b64dc77c..e60c4c976a9 100644
--- a/document/src/vespa/document/repo/document_type_repo_factory.cpp
+++ b/document/src/vespa/document/repo/document_type_repo_factory.cpp
@@ -5,6 +5,9 @@
#include <vespa/document/config/config-documenttypes.h>
#include <iostream>
+#include <vespa/log/log.h>
+LOG_SETUP(".document.repo.document_type_repo_factory");
+
namespace document {
std::mutex DocumentTypeRepoFactory::_mutex;
@@ -22,7 +25,7 @@ EmptyFactoryCheck::~EmptyFactoryCheck()
{
if (!DocumentTypeRepoFactory::empty()) {
std::cerr << "DocumentTypeRepoFactory not empty at shutdown" << std::endl;
- abort();
+ LOG_ABORT("should not be reached");
}
}
diff --git a/document/src/vespa/document/select/result.h b/document/src/vespa/document/select/result.h
index bdfb6c8c0ee..157121b43dd 100644
--- a/document/src/vespa/document/select/result.h
+++ b/document/src/vespa/document/select/result.h
@@ -19,6 +19,7 @@
#pragma once
+#include <assert.h>
#include <vespa/document/util/printable.h>
namespace document::select {
@@ -48,7 +49,7 @@ public:
return 1u;
if (this == &Result::True)
return 2u;
- abort();
+ assert(false); abort();
}
static const Result &fromEnum(uint32_t val) {
@@ -58,7 +59,7 @@ public:
return Result::False;
if (val == 2u)
return Result::True;
- abort();
+ assert(false); abort();
}
private: