I want to create a middleware that will catch an error in the program if it occurs and display its information in the brower console.
What I mean is a functionality that will make it so that if an error appears in any of the razor.cs files, this functionality will write in the browser console such information about this error as its location and type of error. My question is which project's place in blazor web assembly application will be suitable for such middleware? Can it be program.cs ? Or is it possible to create such middleware so that it is in one place but affects all razor.cs files? Any suggestions?
Use program.cs and Add your Middleware on the asp.net pipeline.
This is a sample AdvanceExceptionHandler:
Call the app.UseAdvancedExceptionHandler() in early of program.cs.