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>
This commit is contained in:
Austin Eng 2020-05-13 23:10:36 +00:00 committed by Commit Bot service account
parent ecabfe8a78
commit 75ef5963b4
1 changed files with 7 additions and 1 deletions

View File

@ -210,7 +210,13 @@ namespace dawn_native {
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) {