Improve error message when builder tries to reallocate
A user reported that the error message wasn't helpful in understanding
what they needed to change to stop the error from happening. We can do
better.
Change-Id: Ieb197bc756f81fee6fe71fcc666fb8140def26cd
diff --git a/aos/flatbuffers.cc b/aos/flatbuffers.cc
index 3fe22c0..06d11f4 100644
--- a/aos/flatbuffers.cc
+++ b/aos/flatbuffers.cc
@@ -6,7 +6,8 @@
uint8_t *FixedAllocatorBase::allocate(size_t) {
if (is_allocated_) {
- LOG(FATAL) << "Tried to allocate already allocated flatbuffer";
+ LOG(FATAL) << "Can't allocate more memory with a fixed size allocator. "
+ "Increase the memory reserved.";
}
is_allocated_ = true;
@@ -15,7 +16,8 @@
uint8_t *FixedAllocatorBase::reallocate_downward(uint8_t *, size_t, size_t,
size_t, size_t) {
- LOG(FATAL) << "Tried to reallocate a flatbuffer";
+ LOG(FATAL) << "Can't allocate more memory with a fixed size allocator. "
+ "Increase the memory reserved.";
return nullptr;
}