Append the stack trace to the error message
This makes it much easier to understand where errors come from.
Bug: none
Change-Id: I345164177e6258a32bdc37d233bc5df8bba13132
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21660
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index efa8d2d..4c90c6f 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -210,7 +210,13 @@
void DeviceBase::ConsumeError(std::unique_ptr<ErrorData> error) {
ASSERT(error != nullptr);
- HandleError(error->GetType(), error->GetMessage().c_str());
+ std::ostringstream ss;
+ ss << error->GetMessage();
+ for (const auto& callsite : error->GetBacktrace()) {
+ ss << "\n at " << callsite.function << " (" << callsite.file << ":" << callsite.line
+ << ")";
+ }
+ HandleError(error->GetType(), ss.str().c_str());
}
void DeviceBase::SetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata) {