Skip to content

onErrorCaptured hook fails to capture instanceof error from child component #14041

@chilingling

Description

@chilingling

Vue version

3.5

Link to minimal reproduction

https://play.vuejs.org/#eNqlVE1z0zAQ/StbXZzOOMkBTpk0DHQyUziUDu3AAXMw9tpRkCWNPtIwnvx3VnLthEAz0Ny0n3r79kkte6v1ZOORzdjcFoZrBxad14tM8kYr46AFg1UKSi6NUeY6184bLGEHlVENJFSbDLk3qsEn/2QajNCawpkslLQOGlvDVeg3Sm5QCAVflBHlRXIZUo5uGI3QmBQ41eWywHCq1CVcLaDNJEBoqAROhKpHydMQUHS1QJXKJGmXCcE8bhQCO7oWIBdo3HMtKCNkzacdN8QKGQ4bLXKHZAHMV2HmKZ3n04MAS5mzhLHi9WRtlSR+I5iMFarRnO78qB2nGTI262FmLCdOHj9EnzMe095frLD48Rf/2m6DL2N3Bi2aDWZsiLnc1Oi68PL+Frd0HoKNKr2g7BPBT0j8+oCxS3vnZUmwD/Ii2vdx81zWD3a5dShtP1QAGlmO+Rkjcq9PjL6H+2ryOtYR9cRir6JTAv0nbT6gdQHAoM9gDPo8Q3xBAOeqr5/y/+VX8k080PFiPAZPL61pUDqQtFTBJcIjF4L6+nrlurYp5LL8gzS7Ul6UAwDu4M14fNiaLrZuHOQLM5IIis+58HiVsRbcT40zSNY2obUxeg2wL91X/VZUlXll85gc55h2gxw/on5JL19/9/Noo7Slv6fEiji5C9Yo7mcPagZf750hJadw65vvSDyR5GN++a1bxFk6CRycq5OejrN0YnUuF217MDrsdlQb3M/vYvcLdBgbSQ==

Steps to reproduce

Image Image
  1. In the Home.vue file, uncomment the following line:
  <!-- <test-comp :modelValue="{ type: 'js' }" /> -->
  1. application auto rerendered
  • An error is thrown: Right-hand side of 'instanceof' is not an object
  • The onErrorCaptured hook registered in the parent component does not capture this error
  1. 在 Home.vue 文件中,取消注释以下代码:
  <!-- <test-comp :modelValue="{ type: 'js' }" /> -->
  1. 应用自动重新渲染

实际行为:

抛出错误:Right-hand side of 'instanceof' is not an object
父组件中注册的 onErrorCaptured 钩子未能捕获此错误

What is expected?

Expected Behavior:
The onErrorCaptured hook should successfully capture and handle the error thrown by the child component.

预期行为:
onErrorCaptured 钩子应该能够成功捕获并处理子组件抛出的错误。

What is actually happening?

  • An error is thrown: Right-hand side of 'instanceof' is not an object
  • The onErrorCaptured hook registered in the parent component does not capture this error

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions