Retain descriptor labels for error objects

Since these objects are more likely to be included in error messages
it's important that we keep the labels that the developer has given
them.

Bug: dawn:1771
Change-Id: I78f4ccc23ce40d8eeceed8ca7dd563dff949b4fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/BindGroup.cpp b/src/dawn/native/BindGroup.cpp
index 5a2e3a4..c1345ca 100644
--- a/src/dawn/native/BindGroup.cpp
+++ b/src/dawn/native/BindGroup.cpp
@@ -475,12 +475,12 @@
     ApiObjectBase::DeleteThis();
 }
 
-BindGroupBase::BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag), mBindingData() {}
+BindGroupBase::BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label), mBindingData() {}
 
 // static
-BindGroupBase* BindGroupBase::MakeError(DeviceBase* device) {
-    return new BindGroupBase(device, ObjectBase::kError);
+BindGroupBase* BindGroupBase::MakeError(DeviceBase* device, const char* label) {
+    return new BindGroupBase(device, ObjectBase::kError, label);
 }
 
 ObjectType BindGroupBase::GetType() const {
diff --git a/src/dawn/native/BindGroup.h b/src/dawn/native/BindGroup.h
index 01df670..c8a2c4f 100644
--- a/src/dawn/native/BindGroup.h
+++ b/src/dawn/native/BindGroup.h
@@ -44,7 +44,7 @@
 
 class BindGroupBase : public ApiObjectBase {
   public:
-    static BindGroupBase* MakeError(DeviceBase* device);
+    static BindGroupBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -81,7 +81,7 @@
     ~BindGroupBase() override;
 
   private:
-    BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
     void DeleteThis() override;
 
     Ref<BindGroupLayoutBase> mLayout;
diff --git a/src/dawn/native/BindGroupLayout.cpp b/src/dawn/native/BindGroupLayout.cpp
index 0f9f868..fcedc2c 100644
--- a/src/dawn/native/BindGroupLayout.cpp
+++ b/src/dawn/native/BindGroupLayout.cpp
@@ -491,8 +491,10 @@
     GetObjectTrackingList()->Track(this);
 }
 
-BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag) {}
+BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
+                                         ObjectBase::ErrorTag tag,
+                                         const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 BindGroupLayoutBase::~BindGroupLayoutBase() = default;
 
@@ -504,8 +506,8 @@
 }
 
 // static
-BindGroupLayoutBase* BindGroupLayoutBase::MakeError(DeviceBase* device) {
-    return new BindGroupLayoutBase(device, ObjectBase::kError);
+BindGroupLayoutBase* BindGroupLayoutBase::MakeError(DeviceBase* device, const char* label) {
+    return new BindGroupLayoutBase(device, ObjectBase::kError, label);
 }
 
 ObjectType BindGroupLayoutBase::GetType() const {
diff --git a/src/dawn/native/BindGroupLayout.h b/src/dawn/native/BindGroupLayout.h
index 3b435cd..cfcbf43 100644
--- a/src/dawn/native/BindGroupLayout.h
+++ b/src/dawn/native/BindGroupLayout.h
@@ -61,7 +61,7 @@
                         PipelineCompatibilityToken pipelineCompatibilityToken);
     ~BindGroupLayoutBase() override;
 
-    static BindGroupLayoutBase* MakeError(DeviceBase* device);
+    static BindGroupLayoutBase* MakeError(DeviceBase* device, const char* label = nullptr);
 
     ObjectType GetType() const override;
 
@@ -147,7 +147,7 @@
     }
 
   private:
-    BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     BindingCounts mBindingCounts = {};
     ityp::vector<BindingIndex, BindingInfo> mBindingInfo;
diff --git a/src/dawn/native/Buffer.cpp b/src/dawn/native/Buffer.cpp
index 1a72c90..83f56e7 100644
--- a/src/dawn/native/Buffer.cpp
+++ b/src/dawn/native/Buffer.cpp
@@ -177,7 +177,7 @@
 BufferBase::BufferBase(DeviceBase* device,
                        const BufferDescriptor* descriptor,
                        ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag),
+    : ApiObjectBase(device, tag, descriptor->label),
       mSize(descriptor->size),
       mUsage(descriptor->usage),
       mState(BufferState::Unmapped) {
diff --git a/src/dawn/native/CommandBuffer.cpp b/src/dawn/native/CommandBuffer.cpp
index 061d1c1..fbeb9f2 100644
--- a/src/dawn/native/CommandBuffer.cpp
+++ b/src/dawn/native/CommandBuffer.cpp
@@ -33,12 +33,14 @@
     GetObjectTrackingList()->Track(this);
 }
 
-CommandBufferBase::CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag) {}
+CommandBufferBase::CommandBufferBase(DeviceBase* device,
+                                     ObjectBase::ErrorTag tag,
+                                     const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 // static
-CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device) {
-    return new CommandBufferBase(device, ObjectBase::kError);
+CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device, const char* label) {
+    return new CommandBufferBase(device, ObjectBase::kError, label);
 }
 
 ObjectType CommandBufferBase::GetType() const {
diff --git a/src/dawn/native/CommandBuffer.h b/src/dawn/native/CommandBuffer.h
index 62b7c8b..2ffde90 100644
--- a/src/dawn/native/CommandBuffer.h
+++ b/src/dawn/native/CommandBuffer.h
@@ -34,7 +34,7 @@
   public:
     CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
 
-    static CommandBufferBase* MakeError(DeviceBase* device);
+    static CommandBufferBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -50,7 +50,7 @@
     CommandIterator mCommands;
 
   private:
-    CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     CommandBufferResourceUsage mResourceUsages;
 };
diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp
index f74e0b3..31e9290 100644
--- a/src/dawn/native/CommandEncoder.cpp
+++ b/src/dawn/native/CommandEncoder.cpp
@@ -710,8 +710,8 @@
 }
 
 // static
-CommandEncoder* CommandEncoder::MakeError(DeviceBase* device) {
-    return new CommandEncoder(device, ObjectBase::kError);
+CommandEncoder* CommandEncoder::MakeError(DeviceBase* device, const char* label) {
+    return new CommandEncoder(device, ObjectBase::kError, label);
 }
 
 CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor)
@@ -728,8 +728,8 @@
     }
 }
 
-CommandEncoder::CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag),
+CommandEncoder::CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label),
       mEncodingContext(device, this),
       mUsageValidationMode(UsageValidationMode::Default) {
     mEncodingContext.HandleError(DAWN_VALIDATION_ERROR("%s is invalid.", this));
@@ -830,7 +830,8 @@
         return passEncoder;
     }
 
-    return ComputePassEncoder::MakeError(device, this, &mEncodingContext);
+    return ComputePassEncoder::MakeError(device, this, &mEncodingContext,
+                                         descriptor ? descriptor->label : nullptr);
 }
 
 RenderPassEncoder* CommandEncoder::APIBeginRenderPass(const RenderPassDescriptor* descriptor) {
@@ -1011,14 +1012,16 @@
             MaybeError error =
                 ApplyClearBigIntegerColorValueWithDraw(passEncoder.Get(), descriptor);
             if (error.IsError()) {
-                return RenderPassEncoder::MakeError(device, this, &mEncodingContext);
+                return RenderPassEncoder::MakeError(device, this, &mEncodingContext,
+                                                    descriptor ? descriptor->label : nullptr);
             }
         }
 
         return passEncoder;
     }
 
-    return RenderPassEncoder::MakeError(device, this, &mEncodingContext);
+    return RenderPassEncoder::MakeError(device, this, &mEncodingContext,
+                                        descriptor ? descriptor->label : nullptr);
 }
 
 // This function handles render pass workarounds. Because some cases may require
@@ -1627,7 +1630,7 @@
 
     Ref<CommandBufferBase> commandBuffer;
     if (GetDevice()->ConsumedError(Finish(descriptor), &commandBuffer)) {
-        return CommandBufferBase::MakeError(GetDevice());
+        return CommandBufferBase::MakeError(GetDevice(), descriptor ? descriptor->label : nullptr);
     }
     ASSERT(!IsError());
     return commandBuffer.Detach();
diff --git a/src/dawn/native/CommandEncoder.h b/src/dawn/native/CommandEncoder.h
index 3b8f5fd..6b9d4a5 100644
--- a/src/dawn/native/CommandEncoder.h
+++ b/src/dawn/native/CommandEncoder.h
@@ -40,7 +40,7 @@
   public:
     static Ref<CommandEncoder> Create(DeviceBase* device,
                                       const CommandEncoderDescriptor* descriptor);
-    static CommandEncoder* MakeError(DeviceBase* device);
+    static CommandEncoder* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -119,7 +119,7 @@
 
   private:
     CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor);
-    CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag);
+    CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     void DestroyImpl() override;
 
diff --git a/src/dawn/native/ComputePassEncoder.cpp b/src/dawn/native/ComputePassEncoder.cpp
index 7fbf82b..11254b6 100644
--- a/src/dawn/native/ComputePassEncoder.cpp
+++ b/src/dawn/native/ComputePassEncoder.cpp
@@ -128,15 +128,18 @@
 ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
                                        CommandEncoder* commandEncoder,
                                        EncodingContext* encodingContext,
-                                       ErrorTag errorTag)
-    : ProgrammableEncoder(device, encodingContext, errorTag), mCommandEncoder(commandEncoder) {}
+                                       ErrorTag errorTag,
+                                       const char* label)
+    : ProgrammableEncoder(device, encodingContext, errorTag, label),
+      mCommandEncoder(commandEncoder) {}
 
 // static
 Ref<ComputePassEncoder> ComputePassEncoder::MakeError(DeviceBase* device,
                                                       CommandEncoder* commandEncoder,
-                                                      EncodingContext* encodingContext) {
+                                                      EncodingContext* encodingContext,
+                                                      const char* label) {
     return AcquireRef(
-        new ComputePassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError));
+        new ComputePassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError, label));
 }
 
 void ComputePassEncoder::DestroyImpl() {
diff --git a/src/dawn/native/ComputePassEncoder.h b/src/dawn/native/ComputePassEncoder.h
index f48ef94..ae5de35 100644
--- a/src/dawn/native/ComputePassEncoder.h
+++ b/src/dawn/native/ComputePassEncoder.h
@@ -36,7 +36,8 @@
                                           EncodingContext* encodingContext);
     static Ref<ComputePassEncoder> MakeError(DeviceBase* device,
                                              CommandEncoder* commandEncoder,
-                                             EncodingContext* encodingContext);
+                                             EncodingContext* encodingContext,
+                                             const char* label);
 
     ObjectType GetType() const override;
 
@@ -75,7 +76,8 @@
     ComputePassEncoder(DeviceBase* device,
                        CommandEncoder* commandEncoder,
                        EncodingContext* encodingContext,
-                       ErrorTag errorTag);
+                       ErrorTag errorTag,
+                       const char* label);
 
   private:
     void DestroyImpl() override;
diff --git a/src/dawn/native/ComputePipeline.cpp b/src/dawn/native/ComputePipeline.cpp
index 93d2804..99364e7 100644
--- a/src/dawn/native/ComputePipeline.cpp
+++ b/src/dawn/native/ComputePipeline.cpp
@@ -56,8 +56,10 @@
     StreamIn(&mCacheKey, CacheKey::Type::ComputePipeline, device->GetCacheKey());
 }
 
-ComputePipelineBase::ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : PipelineBase(device, tag) {}
+ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
+                                         ObjectBase::ErrorTag tag,
+                                         const char* label)
+    : PipelineBase(device, tag, label) {}
 
 ComputePipelineBase::~ComputePipelineBase() = default;
 
@@ -69,11 +71,11 @@
 }
 
 // static
-ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device) {
+ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device, const char* label) {
     class ErrorComputePipeline final : public ComputePipelineBase {
       public:
-        explicit ErrorComputePipeline(DeviceBase* device)
-            : ComputePipelineBase(device, ObjectBase::kError) {}
+        explicit ErrorComputePipeline(DeviceBase* device, const char* label)
+            : ComputePipelineBase(device, ObjectBase::kError, label) {}
 
         MaybeError Initialize() override {
             UNREACHABLE();
@@ -81,7 +83,7 @@
         }
     };
 
-    return new ErrorComputePipeline(device);
+    return new ErrorComputePipeline(device, label);
 }
 
 ObjectType ComputePipelineBase::GetType() const {
diff --git a/src/dawn/native/ComputePipeline.h b/src/dawn/native/ComputePipeline.h
index f134579..85794ec 100644
--- a/src/dawn/native/ComputePipeline.h
+++ b/src/dawn/native/ComputePipeline.h
@@ -32,7 +32,7 @@
     ComputePipelineBase(DeviceBase* device, const ComputePipelineDescriptor* descriptor);
     ~ComputePipelineBase() override;
 
-    static ComputePipelineBase* MakeError(DeviceBase* device);
+    static ComputePipelineBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -45,7 +45,7 @@
     void DestroyImpl() override;
 
   private:
-    ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 };
 
 }  // namespace dawn::native
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index dbd306c..0cc3c4b 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -1107,7 +1107,7 @@
     Ref<BindGroupBase> result;
     if (ConsumedError(CreateBindGroup(descriptor), &result, "calling %s.CreateBindGroup(%s).", this,
                       descriptor)) {
-        return BindGroupBase::MakeError(this);
+        return BindGroupBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1116,7 +1116,7 @@
     Ref<BindGroupLayoutBase> result;
     if (ConsumedError(CreateBindGroupLayout(descriptor), &result,
                       "calling %s.CreateBindGroupLayout(%s).", this, descriptor)) {
-        return BindGroupLayoutBase::MakeError(this);
+        return BindGroupLayoutBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1133,7 +1133,7 @@
     Ref<CommandEncoder> result;
     if (ConsumedError(CreateCommandEncoder(descriptor), &result,
                       "calling %s.CreateCommandEncoder(%s).", this, descriptor)) {
-        return CommandEncoder::MakeError(this);
+        return CommandEncoder::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1145,7 +1145,7 @@
     Ref<ComputePipelineBase> result;
     if (ConsumedError(CreateComputePipeline(descriptor), &result,
                       "calling %s.CreateComputePipeline(%s).", this, descriptor)) {
-        return ComputePipelineBase::MakeError(this);
+        return ComputePipelineBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1176,7 +1176,7 @@
     Ref<PipelineLayoutBase> result;
     if (ConsumedError(CreatePipelineLayout(descriptor), &result,
                       "calling %s.CreatePipelineLayout(%s).", this, descriptor)) {
-        return PipelineLayoutBase::MakeError(this);
+        return PipelineLayoutBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1192,7 +1192,7 @@
     Ref<SamplerBase> result;
     if (ConsumedError(CreateSampler(descriptor), &result, "calling %s.CreateSampler(%s).", this,
                       descriptor)) {
-        return SamplerBase::MakeError(this);
+        return SamplerBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1223,7 +1223,7 @@
     Ref<RenderBundleEncoder> result;
     if (ConsumedError(CreateRenderBundleEncoder(descriptor), &result,
                       "calling %s.CreateRenderBundleEncoder(%s).", this, descriptor)) {
-        return RenderBundleEncoder::MakeError(this);
+        return RenderBundleEncoder::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1235,7 +1235,7 @@
     Ref<RenderPipelineBase> result;
     if (ConsumedError(CreateRenderPipeline(descriptor), &result,
                       "calling %s.CreateRenderPipeline(%s).", this, descriptor)) {
-        return RenderPipelineBase::MakeError(this);
+        return RenderPipelineBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -1249,7 +1249,7 @@
     if (ConsumedError(CreateShaderModule(descriptor, compilationMessages.get()), &result,
                       "calling %s.CreateShaderModule(%s).", this, descriptor)) {
         DAWN_ASSERT(result == nullptr);
-        result = ShaderModuleBase::MakeError(this);
+        result = ShaderModuleBase::MakeError(this, descriptor ? descriptor->label : nullptr);
     }
     // Move compilation messages into ShaderModuleBase and emit tint errors and warnings
     // after all other operations are finished, even if any of them is failed and result
diff --git a/src/dawn/native/ExternalTexture.cpp b/src/dawn/native/ExternalTexture.cpp
index 118b25c..8b082fc 100644
--- a/src/dawn/native/ExternalTexture.cpp
+++ b/src/dawn/native/ExternalTexture.cpp
@@ -138,8 +138,10 @@
 }
 
 // Error external texture cannot be used in bind group.
-ExternalTextureBase::ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag), mState(ExternalTextureState::Destroyed) {}
+ExternalTextureBase::ExternalTextureBase(DeviceBase* device,
+                                         ObjectBase::ErrorTag tag,
+                                         const char* label)
+    : ApiObjectBase(device, tag, label), mState(ExternalTextureState::Destroyed) {}
 
 ExternalTextureBase::~ExternalTextureBase() = default;
 
@@ -371,8 +373,8 @@
 }
 
 // static
-ExternalTextureBase* ExternalTextureBase::MakeError(DeviceBase* device) {
-    return new ExternalTextureBase(device, ObjectBase::kError);
+ExternalTextureBase* ExternalTextureBase::MakeError(DeviceBase* device, const char* label) {
+    return new ExternalTextureBase(device, ObjectBase::kError, label);
 }
 
 BufferBase* ExternalTextureBase::GetParamsBuffer() const {
diff --git a/src/dawn/native/ExternalTexture.h b/src/dawn/native/ExternalTexture.h
index b804bf7..36a4579 100644
--- a/src/dawn/native/ExternalTexture.h
+++ b/src/dawn/native/ExternalTexture.h
@@ -55,7 +55,7 @@
     const Origin2D& GetVisibleOrigin() const;
 
     MaybeError ValidateCanUseInSubmitNow() const;
-    static ExternalTextureBase* MakeError(DeviceBase* device);
+    static ExternalTextureBase* MakeError(DeviceBase* device, const char* label = nullptr);
 
     void APIExpire();
     void APIDestroy();
@@ -71,7 +71,7 @@
 
   private:
     enum class ExternalTextureState { Active, Expired, Destroyed };
-    ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     MaybeError ValidateRefresh();
     MaybeError ValidateExpire();
diff --git a/src/dawn/native/ObjectBase.cpp b/src/dawn/native/ObjectBase.cpp
index be9331c..859ebc0 100644
--- a/src/dawn/native/ObjectBase.cpp
+++ b/src/dawn/native/ObjectBase.cpp
@@ -68,7 +68,12 @@
     }
 }
 
-ApiObjectBase::ApiObjectBase(DeviceBase* device, ErrorTag tag) : ObjectBase(device, tag) {}
+ApiObjectBase::ApiObjectBase(DeviceBase* device, ErrorTag tag, const char* label)
+    : ObjectBase(device, tag) {
+    if (label) {
+        mLabel = label;
+    }
+}
 
 ApiObjectBase::ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag) : ObjectBase(device) {}
 
diff --git a/src/dawn/native/ObjectBase.h b/src/dawn/native/ObjectBase.h
index 3bb77d2..daf5cc8 100644
--- a/src/dawn/native/ObjectBase.h
+++ b/src/dawn/native/ObjectBase.h
@@ -79,7 +79,7 @@
 
     ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag);
     ApiObjectBase(DeviceBase* device, const char* label);
-    ApiObjectBase(DeviceBase* device, ErrorTag tag);
+    ApiObjectBase(DeviceBase* device, ErrorTag tag, const char* label = nullptr);
     ~ApiObjectBase() override;
 
     virtual ObjectType GetType() const = 0;
diff --git a/src/dawn/native/Pipeline.cpp b/src/dawn/native/Pipeline.cpp
index cffeaa3..3e2dada 100644
--- a/src/dawn/native/Pipeline.cpp
+++ b/src/dawn/native/Pipeline.cpp
@@ -213,8 +213,8 @@
     }
 }
 
-PipelineBase::PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag) {}
+PipelineBase::PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 PipelineBase::~PipelineBase() = default;
 
diff --git a/src/dawn/native/Pipeline.h b/src/dawn/native/Pipeline.h
index ac879e4..aaee3f2 100644
--- a/src/dawn/native/Pipeline.h
+++ b/src/dawn/native/Pipeline.h
@@ -81,7 +81,7 @@
                  PipelineLayoutBase* layout,
                  const char* label,
                  std::vector<StageAndDescriptor> stages);
-    PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
   private:
     MaybeError ValidateGetBindGroupLayout(BindGroupIndex group);
diff --git a/src/dawn/native/PipelineLayout.cpp b/src/dawn/native/PipelineLayout.cpp
index 93e915f..82f40ce 100644
--- a/src/dawn/native/PipelineLayout.cpp
+++ b/src/dawn/native/PipelineLayout.cpp
@@ -74,8 +74,10 @@
     GetObjectTrackingList()->Track(this);
 }
 
-PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag) {}
+PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
+                                       ObjectBase::ErrorTag tag,
+                                       const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 PipelineLayoutBase::~PipelineLayoutBase() = default;
 
@@ -87,8 +89,8 @@
 }
 
 // static
-PipelineLayoutBase* PipelineLayoutBase::MakeError(DeviceBase* device) {
-    return new PipelineLayoutBase(device, ObjectBase::kError);
+PipelineLayoutBase* PipelineLayoutBase::MakeError(DeviceBase* device, const char* label) {
+    return new PipelineLayoutBase(device, ObjectBase::kError, label);
 }
 
 // static
diff --git a/src/dawn/native/PipelineLayout.h b/src/dawn/native/PipelineLayout.h
index 11e9982..f1b4358 100644
--- a/src/dawn/native/PipelineLayout.h
+++ b/src/dawn/native/PipelineLayout.h
@@ -57,7 +57,7 @@
     PipelineLayoutBase(DeviceBase* device, const PipelineLayoutDescriptor* descriptor);
     ~PipelineLayoutBase() override;
 
-    static PipelineLayoutBase* MakeError(DeviceBase* device);
+    static PipelineLayoutBase* MakeError(DeviceBase* device, const char* label);
     static ResultOrError<Ref<PipelineLayoutBase>> CreateDefault(
         DeviceBase* device,
         std::vector<StageAndDescriptor> stages);
@@ -84,7 +84,7 @@
     };
 
   protected:
-    PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
     void DestroyImpl() override;
 
     BindGroupLayoutArray mBindGroupLayouts;
diff --git a/src/dawn/native/ProgrammableEncoder.cpp b/src/dawn/native/ProgrammableEncoder.cpp
index ce3140b..07b44e7 100644
--- a/src/dawn/native/ProgrammableEncoder.cpp
+++ b/src/dawn/native/ProgrammableEncoder.cpp
@@ -37,8 +37,9 @@
 
 ProgrammableEncoder::ProgrammableEncoder(DeviceBase* device,
                                          EncodingContext* encodingContext,
-                                         ErrorTag errorTag)
-    : ApiObjectBase(device, errorTag),
+                                         ErrorTag errorTag,
+                                         const char* label)
+    : ApiObjectBase(device, errorTag, label),
       mEncodingContext(encodingContext),
       mValidationEnabled(device->IsValidationEnabled()) {}
 
diff --git a/src/dawn/native/ProgrammableEncoder.h b/src/dawn/native/ProgrammableEncoder.h
index 25b730f..cbbeeed 100644
--- a/src/dawn/native/ProgrammableEncoder.h
+++ b/src/dawn/native/ProgrammableEncoder.h
@@ -53,7 +53,10 @@
                             const uint32_t* dynamicOffsets) const;
 
     // Construct an "error" programmable pass encoder.
-    ProgrammableEncoder(DeviceBase* device, EncodingContext* encodingContext, ErrorTag errorTag);
+    ProgrammableEncoder(DeviceBase* device,
+                        EncodingContext* encodingContext,
+                        ErrorTag errorTag,
+                        const char* label);
 
     EncodingContext* mEncodingContext = nullptr;
 
diff --git a/src/dawn/native/QuerySet.cpp b/src/dawn/native/QuerySet.cpp
index 327f304..8f40475 100644
--- a/src/dawn/native/QuerySet.cpp
+++ b/src/dawn/native/QuerySet.cpp
@@ -114,7 +114,9 @@
 QuerySetBase::QuerySetBase(DeviceBase* device,
                            const QuerySetDescriptor* descriptor,
                            ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag), mQueryType(descriptor->type), mQueryCount(descriptor->count) {}
+    : ApiObjectBase(device, tag, descriptor->label),
+      mQueryType(descriptor->type),
+      mQueryCount(descriptor->count) {}
 
 QuerySetBase::~QuerySetBase() {
     // Uninitialized or already destroyed
diff --git a/src/dawn/native/Queue.cpp b/src/dawn/native/Queue.cpp
index 4fee1c0..18039d0 100644
--- a/src/dawn/native/Queue.cpp
+++ b/src/dawn/native/Queue.cpp
@@ -159,7 +159,8 @@
 
 class ErrorQueue : public QueueBase {
   public:
-    explicit ErrorQueue(DeviceBase* device) : QueueBase(device, ObjectBase::kError) {}
+    explicit ErrorQueue(DeviceBase* device, const char* label)
+        : QueueBase(device, ObjectBase::kError, label) {}
 
   private:
     MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override {
@@ -177,7 +178,8 @@
 QueueBase::QueueBase(DeviceBase* device, const QueueDescriptor* descriptor)
     : ApiObjectBase(device, descriptor->label) {}
 
-QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ApiObjectBase(device, tag) {}
+QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 QueueBase::~QueueBase() {
     ASSERT(mTasksInFlight.Empty());
@@ -186,8 +188,8 @@
 void QueueBase::DestroyImpl() {}
 
 // static
-QueueBase* QueueBase::MakeError(DeviceBase* device) {
-    return new ErrorQueue(device);
+QueueBase* QueueBase::MakeError(DeviceBase* device, const char* label) {
+    return new ErrorQueue(device, label);
 }
 
 ObjectType QueueBase::GetType() const {
diff --git a/src/dawn/native/Queue.h b/src/dawn/native/Queue.h
index 61227a6..b95e508 100644
--- a/src/dawn/native/Queue.h
+++ b/src/dawn/native/Queue.h
@@ -49,7 +49,7 @@
   public:
     ~QueueBase() override;
 
-    static QueueBase* MakeError(DeviceBase* device);
+    static QueueBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -84,7 +84,7 @@
 
   protected:
     QueueBase(DeviceBase* device, const QueueDescriptor* descriptor);
-    QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
     void DestroyImpl() override;
 
   private:
diff --git a/src/dawn/native/RenderBundle.cpp b/src/dawn/native/RenderBundle.cpp
index c200cbe..0dd96ba 100644
--- a/src/dawn/native/RenderBundle.cpp
+++ b/src/dawn/native/RenderBundle.cpp
@@ -51,12 +51,12 @@
 }
 
 // static
-RenderBundleBase* RenderBundleBase::MakeError(DeviceBase* device) {
-    return new RenderBundleBase(device, ObjectBase::kError);
+RenderBundleBase* RenderBundleBase::MakeError(DeviceBase* device, const char* label) {
+    return new RenderBundleBase(device, ObjectBase::kError, label);
 }
 
-RenderBundleBase::RenderBundleBase(DeviceBase* device, ErrorTag errorTag)
-    : ApiObjectBase(device, errorTag), mIndirectDrawMetadata(device->GetLimits()) {}
+RenderBundleBase::RenderBundleBase(DeviceBase* device, ErrorTag errorTag, const char* label)
+    : ApiObjectBase(device, errorTag, label), mIndirectDrawMetadata(device->GetLimits()) {}
 
 ObjectType RenderBundleBase::GetType() const {
     return ObjectType::RenderBundle;
diff --git a/src/dawn/native/RenderBundle.h b/src/dawn/native/RenderBundle.h
index f86eb5f..6bae2b6 100644
--- a/src/dawn/native/RenderBundle.h
+++ b/src/dawn/native/RenderBundle.h
@@ -43,7 +43,7 @@
                      RenderPassResourceUsage resourceUsage,
                      IndirectDrawMetadata indirectDrawMetadata);
 
-    static RenderBundleBase* MakeError(DeviceBase* device);
+    static RenderBundleBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -57,7 +57,7 @@
     const IndirectDrawMetadata& GetIndirectDrawMetadata();
 
   private:
-    RenderBundleBase(DeviceBase* device, ErrorTag errorTag);
+    RenderBundleBase(DeviceBase* device, ErrorTag errorTag, const char* label);
 
     void DestroyImpl() override;
 
diff --git a/src/dawn/native/RenderBundleEncoder.cpp b/src/dawn/native/RenderBundleEncoder.cpp
index 7649a3b0..ce1c4ae 100644
--- a/src/dawn/native/RenderBundleEncoder.cpp
+++ b/src/dawn/native/RenderBundleEncoder.cpp
@@ -108,8 +108,8 @@
     GetObjectTrackingList()->Track(this);
 }
 
-RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag)
-    : RenderEncoderBase(device, &mBundleEncodingContext, errorTag),
+RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag, const char* label)
+    : RenderEncoderBase(device, &mBundleEncodingContext, errorTag, label),
       mBundleEncodingContext(device, this) {}
 
 void RenderBundleEncoder::DestroyImpl() {
@@ -125,8 +125,8 @@
 }
 
 // static
-RenderBundleEncoder* RenderBundleEncoder::MakeError(DeviceBase* device) {
-    return new RenderBundleEncoder(device, ObjectBase::kError);
+RenderBundleEncoder* RenderBundleEncoder::MakeError(DeviceBase* device, const char* label) {
+    return new RenderBundleEncoder(device, ObjectBase::kError, label);
 }
 
 ObjectType RenderBundleEncoder::GetType() const {
@@ -142,7 +142,7 @@
 
     if (GetDevice()->ConsumedError(FinishImpl(descriptor), &result, "calling %s.Finish(%s).", this,
                                    descriptor)) {
-        return RenderBundleBase::MakeError(GetDevice());
+        return RenderBundleBase::MakeError(GetDevice(), descriptor ? descriptor->label : nullptr);
     }
 
     return result;
diff --git a/src/dawn/native/RenderBundleEncoder.h b/src/dawn/native/RenderBundleEncoder.h
index b8a9d61..c1daa07 100644
--- a/src/dawn/native/RenderBundleEncoder.h
+++ b/src/dawn/native/RenderBundleEncoder.h
@@ -30,7 +30,7 @@
   public:
     static Ref<RenderBundleEncoder> Create(DeviceBase* device,
                                            const RenderBundleEncoderDescriptor* descriptor);
-    static RenderBundleEncoder* MakeError(DeviceBase* device);
+    static RenderBundleEncoder* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -40,7 +40,7 @@
 
   private:
     RenderBundleEncoder(DeviceBase* device, const RenderBundleEncoderDescriptor* descriptor);
-    RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag);
+    RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag, const char* label);
 
     void DestroyImpl() override;
 
diff --git a/src/dawn/native/RenderEncoderBase.cpp b/src/dawn/native/RenderEncoderBase.cpp
index 36aa9e1..6a989c7 100644
--- a/src/dawn/native/RenderEncoderBase.cpp
+++ b/src/dawn/native/RenderEncoderBase.cpp
@@ -47,8 +47,9 @@
 
 RenderEncoderBase::RenderEncoderBase(DeviceBase* device,
                                      EncodingContext* encodingContext,
-                                     ErrorTag errorTag)
-    : ProgrammableEncoder(device, encodingContext, errorTag),
+                                     ErrorTag errorTag,
+                                     const char* label)
+    : ProgrammableEncoder(device, encodingContext, errorTag, label),
       mIndirectDrawMetadata(device->GetLimits()),
       mDisableBaseVertex(device->IsToggleEnabled(Toggle::DisableBaseVertex)),
       mDisableBaseInstance(device->IsToggleEnabled(Toggle::DisableBaseInstance)) {}
diff --git a/src/dawn/native/RenderEncoderBase.h b/src/dawn/native/RenderEncoderBase.h
index 0cb675a..1407f44 100644
--- a/src/dawn/native/RenderEncoderBase.h
+++ b/src/dawn/native/RenderEncoderBase.h
@@ -67,7 +67,10 @@
 
   protected:
     // Construct an "error" render encoder base.
-    RenderEncoderBase(DeviceBase* device, EncodingContext* encodingContext, ErrorTag errorTag);
+    RenderEncoderBase(DeviceBase* device,
+                      EncodingContext* encodingContext,
+                      ErrorTag errorTag,
+                      const char* label);
 
     void DestroyImpl() override;
 
diff --git a/src/dawn/native/RenderPassEncoder.cpp b/src/dawn/native/RenderPassEncoder.cpp
index aaba03f..5b0b318 100644
--- a/src/dawn/native/RenderPassEncoder.cpp
+++ b/src/dawn/native/RenderPassEncoder.cpp
@@ -102,15 +102,18 @@
 RenderPassEncoder::RenderPassEncoder(DeviceBase* device,
                                      CommandEncoder* commandEncoder,
                                      EncodingContext* encodingContext,
-                                     ErrorTag errorTag)
-    : RenderEncoderBase(device, encodingContext, errorTag), mCommandEncoder(commandEncoder) {}
+                                     ErrorTag errorTag,
+                                     const char* label)
+    : RenderEncoderBase(device, encodingContext, errorTag, label),
+      mCommandEncoder(commandEncoder) {}
 
 // static
 Ref<RenderPassEncoder> RenderPassEncoder::MakeError(DeviceBase* device,
                                                     CommandEncoder* commandEncoder,
-                                                    EncodingContext* encodingContext) {
+                                                    EncodingContext* encodingContext,
+                                                    const char* label) {
     return AcquireRef(
-        new RenderPassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError));
+        new RenderPassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError, label));
 }
 
 void RenderPassEncoder::DestroyImpl() {
diff --git a/src/dawn/native/RenderPassEncoder.h b/src/dawn/native/RenderPassEncoder.h
index 592869d..c0f596f 100644
--- a/src/dawn/native/RenderPassEncoder.h
+++ b/src/dawn/native/RenderPassEncoder.h
@@ -40,7 +40,8 @@
                                          std::function<void()> endCallback = nullptr);
     static Ref<RenderPassEncoder> MakeError(DeviceBase* device,
                                             CommandEncoder* commandEncoder,
-                                            EncodingContext* encodingContext);
+                                            EncodingContext* encodingContext,
+                                            const char* label);
 
     ObjectType GetType() const override;
 
@@ -84,7 +85,8 @@
     RenderPassEncoder(DeviceBase* device,
                       CommandEncoder* commandEncoder,
                       EncodingContext* encodingContext,
-                      ErrorTag errorTag);
+                      ErrorTag errorTag,
+                      const char* label);
 
   private:
     void DestroyImpl() override;
diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp
index f3d26be..48f96fb 100644
--- a/src/dawn/native/RenderPipeline.cpp
+++ b/src/dawn/native/RenderPipeline.cpp
@@ -730,8 +730,10 @@
     StreamIn(&mCacheKey, CacheKey::Type::RenderPipeline, device->GetCacheKey());
 }
 
-RenderPipelineBase::RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : PipelineBase(device, tag) {}
+RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
+                                       ObjectBase::ErrorTag tag,
+                                       const char* label)
+    : PipelineBase(device, tag, label) {}
 
 RenderPipelineBase::~RenderPipelineBase() = default;
 
@@ -747,11 +749,11 @@
 }
 
 // static
-RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device) {
+RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device, const char* label) {
     class ErrorRenderPipeline final : public RenderPipelineBase {
       public:
-        explicit ErrorRenderPipeline(DeviceBase* device)
-            : RenderPipelineBase(device, ObjectBase::kError) {}
+        explicit ErrorRenderPipeline(DeviceBase* device, const char* label)
+            : RenderPipelineBase(device, ObjectBase::kError, label) {}
 
         MaybeError Initialize() override {
             UNREACHABLE();
@@ -759,7 +761,7 @@
         }
     };
 
-    return new ErrorRenderPipeline(device);
+    return new ErrorRenderPipeline(device, label);
 }
 
 ObjectType RenderPipelineBase::GetType() const {
diff --git a/src/dawn/native/RenderPipeline.h b/src/dawn/native/RenderPipeline.h
index 2f37473..ad5593a 100644
--- a/src/dawn/native/RenderPipeline.h
+++ b/src/dawn/native/RenderPipeline.h
@@ -65,7 +65,7 @@
     RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor* descriptor);
     ~RenderPipelineBase() override;
 
-    static RenderPipelineBase* MakeError(DeviceBase* device);
+    static RenderPipelineBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -116,7 +116,7 @@
     void DestroyImpl() override;
 
   private:
-    RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     // Vertex state
     uint32_t mVertexBufferCount;
diff --git a/src/dawn/native/Sampler.cpp b/src/dawn/native/Sampler.cpp
index 8f1b7b9..8b35dc8 100644
--- a/src/dawn/native/Sampler.cpp
+++ b/src/dawn/native/Sampler.cpp
@@ -89,8 +89,8 @@
     GetObjectTrackingList()->Track(this);
 }
 
-SamplerBase::SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag) {}
+SamplerBase::SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label) {}
 
 SamplerBase::~SamplerBase() = default;
 
@@ -102,8 +102,8 @@
 }
 
 // static
-SamplerBase* SamplerBase::MakeError(DeviceBase* device) {
-    return new SamplerBase(device, ObjectBase::kError);
+SamplerBase* SamplerBase::MakeError(DeviceBase* device, const char* label) {
+    return new SamplerBase(device, ObjectBase::kError, label);
 }
 
 ObjectType SamplerBase::GetType() const {
diff --git a/src/dawn/native/Sampler.h b/src/dawn/native/Sampler.h
index 1384327..181a1a4 100644
--- a/src/dawn/native/Sampler.h
+++ b/src/dawn/native/Sampler.h
@@ -36,7 +36,7 @@
     SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor);
     ~SamplerBase() override;
 
-    static SamplerBase* MakeError(DeviceBase* device);
+    static SamplerBase* MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -56,7 +56,7 @@
     void DestroyImpl() override;
 
   private:
-    SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     // TODO(cwallez@chromium.org): Store a crypto hash of the items instead?
     wgpu::AddressMode mAddressModeU;
diff --git a/src/dawn/native/ShaderModule.cpp b/src/dawn/native/ShaderModule.cpp
index ae45a32..262bce1 100644
--- a/src/dawn/native/ShaderModule.cpp
+++ b/src/dawn/native/ShaderModule.cpp
@@ -1110,8 +1110,8 @@
     GetObjectTrackingList()->Track(this);
 }
 
-ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag), mType(Type::Undefined) {}
+ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label), mType(Type::Undefined) {}
 
 ShaderModuleBase::~ShaderModuleBase() = default;
 
@@ -1123,8 +1123,8 @@
 }
 
 // static
-Ref<ShaderModuleBase> ShaderModuleBase::MakeError(DeviceBase* device) {
-    return AcquireRef(new ShaderModuleBase(device, ObjectBase::kError));
+Ref<ShaderModuleBase> ShaderModuleBase::MakeError(DeviceBase* device, const char* label) {
+    return AcquireRef(new ShaderModuleBase(device, ObjectBase::kError, label));
 }
 
 ObjectType ShaderModuleBase::GetType() const {
diff --git a/src/dawn/native/ShaderModule.h b/src/dawn/native/ShaderModule.h
index 5d33cd2..bd3d256 100644
--- a/src/dawn/native/ShaderModule.h
+++ b/src/dawn/native/ShaderModule.h
@@ -258,7 +258,7 @@
     ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor);
     ~ShaderModuleBase() override;
 
-    static Ref<ShaderModuleBase> MakeError(DeviceBase* device);
+    static Ref<ShaderModuleBase> MakeError(DeviceBase* device, const char* label);
 
     ObjectType GetType() const override;
 
@@ -292,7 +292,7 @@
                               OwnedCompilationMessages* compilationMessages);
 
   private:
-    ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     // The original data in the descriptor for caching.
     enum class Type { Undefined, Spirv, Wgsl };
diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp
index 5c13abf..b188b76 100644
--- a/src/dawn/native/Texture.cpp
+++ b/src/dawn/native/Texture.cpp
@@ -584,7 +584,7 @@
 TextureBase::TextureBase(DeviceBase* device,
                          const TextureDescriptor* descriptor,
                          ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag),
+    : ApiObjectBase(device, tag, descriptor->label),
       mDimension(descriptor->dimension),
       mFormat(kUnusedFormat),
       mSize(descriptor->size),
@@ -796,7 +796,7 @@
     Ref<TextureViewBase> result;
     if (device->ConsumedError(CreateView(descriptor), &result, "calling %s.CreateView(%s).", this,
                               descriptor)) {
-        return TextureViewBase::MakeError(device);
+        return TextureViewBase::MakeError(device, descriptor ? descriptor->label : nullptr);
     }
     return result.Detach();
 }
@@ -849,16 +849,16 @@
     GetObjectTrackingList()->Track(this);
 }
 
-TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag)
-    : ApiObjectBase(device, tag), mFormat(kUnusedFormat) {}
+TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
+    : ApiObjectBase(device, tag, label), mFormat(kUnusedFormat) {}
 
 TextureViewBase::~TextureViewBase() = default;
 
 void TextureViewBase::DestroyImpl() {}
 
 // static
-TextureViewBase* TextureViewBase::MakeError(DeviceBase* device) {
-    return new TextureViewBase(device, ObjectBase::kError);
+TextureViewBase* TextureViewBase::MakeError(DeviceBase* device, const char* label) {
+    return new TextureViewBase(device, ObjectBase::kError, label);
 }
 
 ObjectType TextureViewBase::GetType() const {
diff --git a/src/dawn/native/Texture.h b/src/dawn/native/Texture.h
index b6c2143..54676d0 100644
--- a/src/dawn/native/Texture.h
+++ b/src/dawn/native/Texture.h
@@ -140,7 +140,7 @@
     TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor);
     ~TextureViewBase() override;
 
-    static TextureViewBase* MakeError(DeviceBase* device);
+    static TextureViewBase* MakeError(DeviceBase* device, const char* label = nullptr);
 
     ObjectType GetType() const override;
 
@@ -160,7 +160,7 @@
     void DestroyImpl() override;
 
   private:
-    TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag);
+    TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
 
     ApiObjectList* GetObjectTrackingList() override;