Skip to content

Error thrown from beforeDelete hook is not fully shown in document view #14377

@jessrynkar

Description

@jessrynkar

Describe the Bug

The error message sent from the beforeDelete hook display correctly in the collection list view, but in the single document view only a generic "Something went wrong." appears and the actual error message is getting swallowed.

Expected behavior: The full error message is displayed for regardless of view (collection/document).

Link to the code that reproduces this issue

branch fix/before-delete-error

Reproduction Steps

  1. Go to Posts collection list view
  2. Check the checkbox for Example post
  3. Hit delete
  4. See Test Error in toast error

Next

  1. Open Example Post
  2. Hit delete
  3. See error only shows 'Something went wrong.'

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 23.11.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.7.1
Relevant Packages:
  payload: 3.61.1
  @payloadcms/payload-cloud: 3.61.1
Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions