Skip to content

[blazor] Add parameter to ErrorBoundary to let it render ChildContent when an exception was thrown#66159

Open
zachneu wants to merge 2 commits intodotnet:mainfrom
zachneu:ZN/ErrorBoundaryRenderContent
Open

[blazor] Add parameter to ErrorBoundary to let it render ChildContent when an exception was thrown#66159
zachneu wants to merge 2 commits intodotnet:mainfrom
zachneu:ZN/ErrorBoundaryRenderContent

Conversation

@zachneu
Copy link
Copy Markdown

@zachneu zachneu commented Apr 4, 2026

This is extending ErrorBoundary for handling exceptions in Blazor without being forced to render something else (by using ErrorContent) than the component that throw the exception. This is to:

  • Keep the component state if for example a "click to save" action fails
  • Partly render the component if for example it fails to load data

It can be used like
<ErrorBoundary RenderOnException="true">...</ErrorBoundary>

Or your own component with custom OnErrorAsync like
<ErrorBoundaryTest RenderOnException="true">...</ErrorBoundaryTest>
##66214

@zachneu zachneu requested a review from a team as a code owner April 4, 2026 20:26
@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Apr 4, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 4, 2026
@zachneu
Copy link
Copy Markdown
Author

zachneu commented Apr 4, 2026

@dotnet-policy-service agree

@zachneu zachneu force-pushed the ZN/ErrorBoundaryRenderContent branch from 296dab1 to bd09492 Compare April 5, 2026 18:32
@zachneu zachneu force-pushed the ZN/ErrorBoundaryRenderContent branch from bd09492 to 53e5a47 Compare April 7, 2026 08:09
@javiercn
Copy link
Copy Markdown
Member

javiercn commented Apr 8, 2026

Thanks for the contribution @zachneu! We appreciate your interest in improving the ErrorBoundary component.

However, per our contribution policy, we ask that contributors file an issue and discuss the design with the team before submitting a pull request. Specifically:

If you would like to make a contribution to an area not documented here, first open an issue with a description of the change you would like to make and the problem it solves so it can be discussed before a pull request is submitted.

Additionally, for feature work like this, we encourage you to file a design proposal issue so the team can review the approach before significant effort is invested:

You find an existing issue with the "help-wanted" label or discuss with the team to agree on adding a new issue with that label. You post a high-level description of how it will be implemented and receive a positive acknowledgement from the team before getting too committed to the approach or investing too much effort in implementing it.

Could you please open an issue describing the scenario and proposed design so the team can discuss it first?

@zachneu
Copy link
Copy Markdown
Author

zachneu commented Apr 8, 2026

Thanks for the contribution @zachneu! We appreciate your interest in improving the ErrorBoundary component.

However, per our contribution policy, we ask that contributors file an issue and discuss the design with the team before submitting a pull request. Specifically:

If you would like to make a contribution to an area not documented here, first open an issue with a description of the change you would like to make and the problem it solves so it can be discussed before a pull request is submitted.

Additionally, for feature work like this, we encourage you to file a design proposal issue so the team can review the approach before significant effort is invested:

You find an existing issue with the "help-wanted" label or discuss with the team to agree on adding a new issue with that label. You post a high-level description of how it will be implemented and receive a positive acknowledgement from the team before getting too committed to the approach or investing too much effort in implementing it.

Could you please open an issue describing the scenario and proposed design so the team can discuss it first?

Yes, @javiercn I can do that, but this have been something that has been asked for many places for long time, so I though to investigate what would be required to actually solve this, instead of spending time on open an issue, as the current version of errorboundary is basically useless for our needs.

@zachneu zachneu force-pushed the ZN/ErrorBoundaryRenderContent branch from cc89dec to b4945b5 Compare April 8, 2026 12:07
@zachneu
Copy link
Copy Markdown
Author

zachneu commented Apr 8, 2026

#66214

@zachneu zachneu force-pushed the ZN/ErrorBoundaryRenderContent branch from b4945b5 to 3c10ca6 Compare April 8, 2026 16:52
@zachneu zachneu force-pushed the ZN/ErrorBoundaryRenderContent branch from 3c10ca6 to 0e7d02c Compare April 8, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants