Just found your channel. Pure gold. I’ve been developing for 12 years, and I’ve never seen more precise content. Sometimes it’s great to see your own approaches validated and learn new ways of working and tools on the way
Really curios to hear what you thought of the video. Was diving into the framework's code useful? Would it have been better to only demonstrate the error endpoint with the factory instead of the various options?
Another great video, thanks! I really liked the progressive approach and showing all the options, I think your content is for the more advanced developer who can appreciate that there are many tools available to solve a problem and can choose the right tool for the scenario. I’ve been using the Hellang library to create my problem details and that has some nice features also.
This is very good content, and the speed is perfect. Well explained, and as mentioned elsewhere, the progressive approach that shows the different approaches is very useful, please do continue to follow that pattern. Examining the Framework code is also useful - personally, that is how I investigate new technologies when they are released. There are already hundreds of channels that cover an introductory approach to the subject, so it's good to actually see content for established developers, that already know the basics but are interested in guidance / discussion. That is really an area that few people are targeting - Nick Chapsas is the only one who springs to mind, but he doesn't really do "real world applications", it's more specific technologies or language features.
Wow, today I started to build a new app just to learn some new things. I had some questions that I haven't found answers to for a while. You've already answered the some of them. Great guide!
Found this series now and I must say they are so good! You manage to fit so much helpful content in such a short time, and has really opened my eyes for new areas in dotnet. Also, great to be able to follow your workflow (how to walk through other source code) and all the plugins used in vscode.
I love your pace. Thank you for all these detailed and direct to the point video. These videos are not for beginners but they can follow along and read about the methods and style of coding and patterns that you are following. Diving into the source code to give details of implementation is great. Really clear some of the things which happen magically.
finally, thanks! I'm learning asp net and did good job until that point when i realized that every extend or change led to 2-3 hours of debugging. Project was 100% monolith and i didn't know what to do. Yes, I could write working apps, but they were always very messy ;( Keep going
Interesting approach with the error endpoint. My personal favorite is using an exception-handling middleware. I also like to implement the IMiddleware interface for strong typing, it won't hurt.
Yes, that's a safer approach. I wanted to avoid talking about adding it to the IoC container. Do you return ProblemDetails from your services or a custom error response?
@@MilanJovanovicTech I see. For some reason many project define their own error model instead of using the common RFC specification. Perhaps it's not known enough yet
Great video! I'd like to note that you can actually inject a ProblemDetailsFactory either into a middleware or a filter attribute. So you can combine the benefit of using the ProblemDetailsFactory even with the 'middleware' or the 'filter' aproach.
I know this video has been out for a minute or two. I just want to make sure I understand the premises correctly here. The title is referring to "Global Error Handling", yet we are predominantly dealing with the aspects of an HTTP context. How is this global in any sense? I can understand the benefit and use case for this, I am merely curious about the scope for this, because Global is a rather large scope, and I don't see this error handling being able to capture something like a null ref exception in a part of the code that is not dealing with the http context. So, all in all, love the series and this video as well! Just getting somewhat confused on this specific terminology, perhaps it should be something like "Global API Error Response" or "HttpContext Error Response". Please tell me if I am totally going off my rails here :) And again, good series Amichai :)
Hey sensei! Are we gonna see unit testing? I'm really curious to see how we can manage unit testing with this kind of project, because in many videos you said that you change some code in order to test it easier in the future! Thank you very much for all the effort again, you are changing lifes with this types of videos.
Need help the DefaultProblemDetailsFactory now references ProblemDetailsContext and ProblemDetailsOptions that I can't seem to resolve in the BuberDinnerProblemDetailsFactory
Excelent series I'm enjoying it a lot. It would have been nice if Microsoft made that private method you modify in the custom factory implementation protected :)
Hi Amichai, 1st, I wanna say you 1000 times thanks! for such a structured tutorial with schemes. I just wonder, why HandleExceptionAsync generated method is static? Thanks again.
It's a great series. I have a query: we often have requirements to log the API request and response when it gives unexpected results in the data access layer with its request and response. For example, when we are calling an API, if it returns an unsuccessful response, we want to log the request and the response along with the GUID passed in the request. Here in clean architecture, how can we use a common implementation for logging? We may need to log at different stages in a flow based on the business rules or exceptions. Stages: API-request and response logging (Middleware) Application-Logging based on the business case failure or unexpected failure. Infrastructure-when the API gives an unexpected response.
I guess I've got the solution. Basically, I need to create an interface ILoggerService in the application and implement it in the infrastructure. And using this abstraction, I can use it in the API, application, and infrastructure projects.
Is user already registered really an "exception"? Sounds like using exceptions for business logic anti-pattern. Wouldn't some type of Result class or tuple be better so you are avoiding exceptions? (yes I know it is sort of orthogonal to the actual method of handling exceptions).
PowerToys (which has bunch of other useful tools that other OSes have built-in, this particular one is called PowerToys Run, Alt + Space, like Cmd + Space on MacOS)
Thanks for the awesome content! Is adding "customProperty" really relevant using the custom problem details factory? Shouldn't I be having different extensions to the problem details depending on the error or endpoint called?
I make the UseExceptionHandler Middlewae + the Error endpoint etc.. But when I start application and test the endpoint with an error, Visual Studio throws me a "Non handled exception by user's window " and stop the flow of the request. I really don't get it why. I saw your others videos and all is as same as you. If you may have any idea, you'll be the boss ( more than you already are :D )
We are using Chillicream's Hotchocolate GraphQL with .NET 6 (with schema stitching with & redis cache in Azure for hot reload). We decided to use layout our downstream services (microservices) using your project layout in your series. Do you think one day you can make a video about how to use GraphQL with Clean Arch & DDD, specifically using Hotchocolate? Thank you
What if I want to throw the exception from .NET core via middleware, action filter or anything else and want to receive or show that error in Angular 404 or 500 page with the error message?
First of all, fantastic video! Is there any specific reason why you are using HttpStatusCode enum that you are then casting to integer? As opposed to the StatusCodes which are integers already? Just curious :)
Hello sir, thanks for great explanation. I am just wondering let's say we have global exception handling middleware, and can we say that our API never crash? I mean any error we have the the code will hit the catch in our middleware and it will return an message to clients in worst scenario right? So in this case can we say that an API which has global exception handling middleware never crashes? Thank you very much again for great videos 💯
Hi Amichai, I am wondering how this code generated automatically when you just type "ErrorHandlingMiddleware", do I need to install any extension to achieve this?
Hi Amichai, congratulations for this series you are amazing. Can you explain to me? if you have `FormOptions` set with size limit, how can you catch in Global Error Handling if the payload is too large and map the error to an problem detail with status code 413. Would be useful when uploading images. services.Configure(s => { options.ValueLengthLimit = 1000; options.MultipartBodyLengthLimit = 1000; options.MemoryBufferThreshold = 1000; });
Hi, Thanks for informative video. Is it possible to use this approach instead of CustomProblemDetailsFactory ? [Route("/error")] public IActionResult Error() { var exceptionHandlerFeature = HttpContext.Features.Get(); var exception = exceptionHandlerFeature?.Error; var path = exceptionHandlerFeature?.Path; var problemResult = Problem(title: exception.Message, statusCode: 400, instance: path); var problemDetails = problemResult.Value as ProblemDetails; problemDetails.Extensions.Add("customProperty", "customValue"); return problemResult; }
Another great video, well explained, i like your videos, keep it up plz Demande: can you please show the keystrokes on the screen? oh man the way you are using VS code is so impressive, i would like to learn all those keystockes
Thanks, Mourad! I tried it with a draft video and I was worried it made the screen too cluttered. Especially with the vim extension which I use to navigate around the screen. If you are reading the comments and you would also like this, give this comment a like and I'll give it a try if enough of you are interested 🤙
Personally, I would prefer a dedicated video showcasing this (+maybe additional) extensions and how you use them so efficiently. In that video, showing all keystrokes would be amazing. In general, though, I think it will distract too much from the content which is very well paced already. Keep it up, you are already amongst my favorite coding youtube channels after 4 episodes. 👍
Hi. Thank you for this great video. In this video, something caught my attention. When you gone to definition of ControllerBase, its content was visible. But for me only the summary is visible and the implementation is not available. How can you do it?
You just got a supporter on patreon, great video! However, I seem to get an error in swagger when I'm implementing the third solution. Swagger starts and I get a an 500 where it says: Failed to load API definition. Do you happen to know why?
It It was a lot easier with the previous .NET v4.x; We could write something like the following, out-of-the box : 1) return Request.CreateErrorResponse(HttpStatusCode.NotFound, message); 2) throw new HttpResponseException( Request.CreateErrorResponse( HttpStatusCode.NotFound, message) ); Any client library (e.g. axios, fetch) could easily capture the status-code, and custom message thrown by the web-api without much effort on the Dev's part. Does anyone seriously think this is progress?
Every time Copilot gives me what I want, I now can’t help but say “yeeesss?” Keep these videos coming; excellent content!
Haha thanks 🙏
Just found your channel. Pure gold. I’ve been developing for 12 years, and I’ve never seen more precise content. Sometimes it’s great to see your own approaches validated and learn new ways of working and tools on the way
Really enjoying this series. I already learned a few cool things and am looking forward to the DDD parts💪
Really curios to hear what you thought of the video. Was diving into the framework's code useful? Would it have been better to only demonstrate the error endpoint with the factory instead of the various options?
Very useful. And it was also clever to open the repo in dev-containers. 👏
Another great video, thanks! I really liked the progressive approach and showing all the options, I think your content is for the more advanced developer who can appreciate that there are many tools available to solve a problem and can choose the right tool for the scenario. I’ve been using the Hellang library to create my problem details and that has some nice features also.
@@gold15o2 In the next video we'll see a more practical example of how ProblemDetails can be used to represents one or more errors
This is very good content, and the speed is perfect. Well explained, and as mentioned elsewhere, the progressive approach that shows the different approaches is very useful, please do continue to follow that pattern. Examining the Framework code is also useful - personally, that is how I investigate new technologies when they are released.
There are already hundreds of channels that cover an introductory approach to the subject, so it's good to actually see content for established developers, that already know the basics but are interested in guidance / discussion. That is really an area that few people are targeting - Nick Chapsas is the only one who springs to mind, but he doesn't really do "real world applications", it's more specific technologies or language features.
@@amantinband Perhaps including Validation errors.... maybe with both built-in and Fluent Validation... hint hint lol
This is so far the best video on Global error handling in rest api . Excellent video and eagerly waiting for the next one!!!
By far the best video on ErrorHandling I have ever seen. Very usefull and coincidentally what I'm about to implement in a project!
Wow, today I started to build a new app just to learn some new things. I had some questions that I haven't found answers to for a while. You've already answered the some of them. Great guide!
Found this series now and I must say they are so good! You manage to fit so much helpful content in such a short time, and has really opened my eyes for new areas in dotnet.
Also, great to be able to follow your workflow (how to walk through other source code) and all the plugins used in vscode.
These videos are so loaded with info, I have to slow them down to keep up
This playlist is incredible, I'm learning a lot of aspnet core features. Thank you so much for this!
I love your pace. Thank you for all these detailed and direct to the point video. These videos are not for beginners but they can follow along and read about the methods and style of coding and patterns that you are following. Diving into the source code to give details of implementation is great. Really clear some of the things which happen magically.
finally, thanks!
I'm learning asp net and did good job until that point when i realized that every extend or change led to 2-3 hours of debugging. Project was 100% monolith and i didn't know what to do. Yes, I could write working apps, but they were always very messy ;(
Keep going
Hey,
Thanks for putting together this great video series on data engineering! I'm really enjoying it.
Keep up the great work
Interesting approach with the error endpoint. My personal favorite is using an exception-handling middleware. I also like to implement the IMiddleware interface for strong typing, it won't hurt.
Yes, that's a safer approach. I wanted to avoid talking about adding it to the IoC container. Do you return ProblemDetails from your services or a custom error response?
@@amantinband I return a ProblemDetails response, but with my own kind of format 🤔
@@MilanJovanovicTech I see. For some reason many project define their own error model instead of using the common RFC specification. Perhaps it's not known enough yet
@@amantinband Most of the APIs I've seen in the wild aren't even RESTful, so nothing surprises me 😁
Yes, I like to handle exception handling by using middleware. But for custom error handling according to @Amichai error detail factory is better.
Great video!
I'd like to note that you can actually inject a ProblemDetailsFactory either into a middleware or a filter attribute. So you can combine the benefit of using the ProblemDetailsFactory even with the 'middleware' or the 'filter' aproach.
I know this video has been out for a minute or two. I just want to make sure I understand the premises correctly here. The title is referring to "Global Error Handling", yet we are predominantly dealing with the aspects of an HTTP context. How is this global in any sense? I can understand the benefit and use case for this, I am merely curious about the scope for this, because Global is a rather large scope, and I don't see this error handling being able to capture something like a null ref exception in a part of the code that is not dealing with the http context.
So, all in all, love the series and this video as well! Just getting somewhat confused on this specific terminology, perhaps it should be something like "Global API Error Response" or "HttpContext Error Response". Please tell me if I am totally going off my rails here :)
And again, good series Amichai :)
Loving this series, please continue, Thank you
Probably one of the best instructional videos I have watched!
Great ! Didn't know about the problem details rfc recommandation !
Really enjoying the series so far, keep up the good work!
קצת תוכן ישראלי איכותי עם מבטא זה תמיד טוב 😁
Hey sensei!
Are we gonna see unit testing? I'm really curious to see how we can manage unit testing with this kind of project, because in many videos you said that you change some code in order to test it easier in the future!
Thank you very much for all the effort again, you are changing lifes with this types of videos.
Yup 🤙
thanks for sharing all this information.. really appreciate your efforts. it helps alot.. keep sharing good stuff!!
Need help the DefaultProblemDetailsFactory now references ProblemDetailsContext and ProblemDetailsOptions that I can't seem to resolve in the BuberDinnerProblemDetailsFactory
I just remove this and this work for me
Series is awesome, really looking forward to seeing how this progresses 🙂
Awesome to hear. Thanks, Myles!
Thank you
How can we dynamically pass the http status code to the /error endpoint?
Love this series! Very informative and reaffirming!
To be honest, when i started watching the video, i didn't like the way you talked fast, but the deep explanation you gave made up for it
Thanks for the feedback, Kyree
Just seeing you how you use VS Code, I'm learning more
very detailed video. you have high standards. thanks!
Completely agree with Daniel, putting into a separate video would be better, keeping the videos a bit cleaner
Excelent series I'm enjoying it a lot. It would have been nice if Microsoft made that private method you modify in the custom factory implementation protected :)
Really really helpful for a new guy, thank you so much
Awesome content, really informative and well explained! Thank a lot.
Purely mind blowing... How did you even gain such command over c#
any learning paths would be much appreciated
Thanks for all the content you provide
Haha you gotta remember these videos are edited and I wrote the same (or almost the same) code multiple times in the past
Hi Amichai, 1st, I wanna say you 1000 times thanks! for such a structured tutorial with schemes.
I just wonder, why HandleExceptionAsync generated method is static? Thanks again.
Thanks Sergey! When methods aren’t dependent on non-static fields or properties it’s preferable to define them as static.
nice series, i love it. thank you so much
It's a great series.
I have a query: we often have requirements to log the API request and response when it gives unexpected results in the data access layer with its request and response.
For example, when we are calling an API, if it returns an unsuccessful response, we want to log the request and the response along with the GUID passed in the request. Here in clean architecture, how can we use a common implementation for logging? We may need to log at different stages in a flow based on the business rules or exceptions.
Stages:
API-request and response logging (Middleware)
Application-Logging based on the business case failure or unexpected failure.
Infrastructure-when the API gives an unexpected response.
I guess I've got the solution. Basically, I need to create an interface ILoggerService in the application and implement it in the infrastructure. And using this abstraction, I can use it in the API, application, and infrastructure projects.
Everything is super clear explanied and very helpful. But I have one question. Why don't you use Visual Studio?
subed, imaging access to this kind of knowledge for free
Wow. Is it possible to remove even the traceID, type from the default problem details factory?
Is user already registered really an "exception"? Sounds like using exceptions for business logic anti-pattern. Wouldn't some type of Result class or tuple be better so you are avoiding exceptions?
(yes I know it is sort of orthogonal to the actual method of handling exceptions).
The next video will be all about replacing exceptions for flow control with a monad approach. I think you’ll like it 😉
Thanks bro, amazing content as always.
Hi, but in the caller, for example blazor, how should i handle problem details response, with a new exception?
Thanks you! Very good series!
Keep it coming, thank you!
Good video, for some reason the ProblemDetailsFactory toss up an error about not having the CreateValidationProblemDetails function in its class.
I want to ask which extension suggested a bunch of code to him? Thanks.
So which one use?? which one provide an best capture when a need use a capture logger?
Can you explain what the TraceId is for? And how do I use it? :)
Thanks god I found your channel thank you so much
How did you open that mini search tool to open VS Code? is that built-in windows feature?
Excellent Series.
I love your videos. Keep going :)
Awesome to hear. Thanks, Qniken 🤙
Hey, love this series! Which tool are you using 16:00 to open VS Code?
PowerToys (which has bunch of other useful tools that other OSes have built-in, this particular one is called PowerToys Run, Alt + Space, like Cmd + Space on MacOS)
Yup, PowerToys. Has a few really awesome features 🤙
how to get traceId if using exception handling middleware
Nice video. More curious about whether you have any plugin installed which gives detailed code intelli and colorful breadcrumbs in the terminal?
How did it suggest that all that code? Can i get that enabled in visual studio 2022?
Thanks!
awesome course, thanks a lot
Great video as always
@1:14 sir could you please tell me what application use to create this beautiful project presentation flow. Thank you 🤍🙏🏻
02:30 how did you do to autocomple ErrorHandlingMiddelware class?
when i saw the blue status bar with the green button in the lower left corner, for a second i thought i was looking at Windows XP
Thanks for the awesome content!
Is adding "customProperty" really relevant using the custom problem details factory? Shouldn't I be having different extensions to the problem details depending on the error or endpoint called?
I make the UseExceptionHandler Middlewae + the Error endpoint etc.. But when I start application and test the endpoint with an error, Visual Studio throws me a "Non handled exception by user's window " and stop the flow of the request. I really don't get it why. I saw your others videos and all is as same as you.
If you may have any idea, you'll be the boss ( more than you already are :D )
Thanks. How to implement audit in .net core?
We are using Chillicream's Hotchocolate GraphQL with .NET 6 (with schema stitching with & redis cache in Azure for hot reload). We decided to use layout our downstream services (microservices) using your project layout in your series. Do you think one day you can make a video about how to use GraphQL with Clean Arch & DDD, specifically using Hotchocolate? Thank you
I'll add it to my backlog. Perhaps at the end of the series I'll look into it
What if I want to throw the exception from .NET core via middleware, action filter or anything else and want to receive or show that error in Angular 404 or 500 page with the error message?
in what way is the "error endpoint/custom problem details factory" strategy better than using a middleware?
Great insight!
Great stuff.. Many thanks.. When is the next one?
Now 😉
Good video thanks
how about docker support, if for example you've got 2 or more adapters in DDD?
סדרה מדהימה! תודה על ההשקעה🙏
How does returning a custom object upon error work with expecting exact DTO from the endpoint? Doesn't it break the logic?
Great video! Tx!
Can the "/error" endpoint be inaccessible to clients and be accessible only in-proc?
First of all, fantastic video!
Is there any specific reason why you are using HttpStatusCode enum that you are then casting to integer? As opposed to the StatusCodes which are integers already? Just curious :)
What extension do you use to get that auto completion/suggestion once you create the file and even before you start typing?
Amazing Content !!
Hello sir, thanks for great explanation. I am just wondering let's say we have global exception handling middleware, and can we say that our API never crash? I mean any error we have the the code will hit the catch in our middleware and it will return an message to clients in worst scenario right? So in this case can we say that an API which has global exception handling middleware never crashes? Thank you very much again for great videos 💯
15:01
Failed to load API definition.
Errors
Hide :(((
i think your code missing httpget in errorscontroller
Can I use UseExceptionHandler for bad request status code?
eeeyesss!!!
which software are you using for the red rectangles and arrows that appear on screen?
Hi Amichai, I am wondering how this code generated automatically when you just type "ErrorHandlingMiddleware", do I need to install any extension to achieve this?
Really enjoying this series. Can you please tell me what software you use to make the infographic layouts that you show on your videos?
I use Figma for all the design stuff & ZoomIt to draw on the screen
Hi Amichai, congratulations for this series you are amazing.
Can you explain to me? if you have `FormOptions` set with size limit, how can you catch in Global Error Handling if the payload is too large and map the error to an problem detail with status code 413. Would be useful when uploading images.
services.Configure(s =>
{
options.ValueLengthLimit = 1000;
options.MultipartBodyLengthLimit = 1000;
options.MemoryBufferThreshold = 1000;
});
Hi, Thanks for informative video. Is it possible to use this approach instead of CustomProblemDetailsFactory ?
[Route("/error")]
public IActionResult Error()
{
var exceptionHandlerFeature = HttpContext.Features.Get();
var exception = exceptionHandlerFeature?.Error;
var path = exceptionHandlerFeature?.Path;
var problemResult = Problem(title: exception.Message, statusCode: 400, instance: path);
var problemDetails = problemResult.Value as ProblemDetails;
problemDetails.Extensions.Add("customProperty", "customValue");
return problemResult;
}
Another great video, well explained, i like your videos, keep it up plz
Demande: can you please show the keystrokes on the screen? oh man the way you are using VS code is so impressive, i would like to learn all those keystockes
Thanks, Mourad! I tried it with a draft video and I was worried it made the screen too cluttered. Especially with the vim extension which I use to navigate around the screen. If you are reading the comments and you would also like this, give this comment a like and I'll give it a try if enough of you are interested 🤙
Personally, I would prefer a dedicated video showcasing this (+maybe additional) extensions and how you use them so efficiently. In that video, showing all keystrokes would be amazing. In general, though, I think it will distract too much from the content which is very well paced already.
Keep it up, you are already amongst my favorite coding youtube channels after 4 episodes. 👍
Super video, BTW what is the extension that auto complete your code (the whole class) for you?
Thanks, GitHub Co-Pilot
Wow, good Stuff!
Thanks!
Hi. Thank you for this great video. In this video, something caught my attention. When you gone to definition of ControllerBase,
its content was visible. But for me only the summary is visible and the implementation is not available. How can you do it?
The suggestions are coming from the GitHub Co-Pilot extension. It now publicly available and costs 10$ a month
I'm getting 404 instead of 500. Using .NET 7.0.
Whats the font name???
You just got a supporter on patreon, great video! However, I seem to get an error in swagger when I'm implementing the third solution. Swagger starts and I get a an 500 where it says: Failed to load API definition. Do you happen to know why?
You need to mark the controller as : [ApiExplorerSettings(IgnoreApi = true)]
I had the same problem
What are you using to show the screenshot contents?
Figma
Hi can I get Buber dinner app source code if any chance
Hi Muralikrishnachowdary, the source code is available for patrons, but you can follow the series all along by following the videos
@@amantinband i join as patron i can get total dinner app code
It It was a lot easier with the previous .NET v4.x; We could write something like the following, out-of-the box :
1) return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
2) throw new HttpResponseException( Request.CreateErrorResponse( HttpStatusCode.NotFound, message) );
Any client library (e.g. axios, fetch) could easily capture the status-code, and custom message thrown by the web-api without much effort on the Dev's part. Does anyone seriously think this is progress?