Using ASP.NET Core Health Checks With ASP.NET Ful...
Health checks in ASP.NET Core are useful for reporting the health of your ASP.NET Core web application. But, this functionality can’t dir...
.NETHealth checks in ASP.NET Core are useful for reporting the health of your ASP.NET Core web application. But, this functionality can’t dir...
.NETAs I’ve walked through upgrading a number of solutions to target a new version of the .NET Framework, I’ve compiled a list of helpful ste...
.NETWhat is WSL? Windows Subsytsem for Linux (aka WSL) is an excellent tool for running Linux-based binaries natively in Windows. With the i...
WSL git ASP.NET MVCIn development it is common to not want to share everything in our code. Things like usernames, password, links to an api, and more shoul...
Vue.js JavaScript WebpackIn Vue computed properties are a life saver when it comes to being able to add logic to data that we need to use in the UI. We want to ke...
Vue.js JavaScriptUpdated Solution! Thanks for the post!If you don't want to create a web.config, you can also drive this through the <AspNetCoreHo...
asp.net asp.net coreI, Khalid Abuhakmeh, recently wrote about my [Razor Pages first impressions][khalid] and am mostly positive about the addition to the ASP...
asp.net asp.net core razorWe’re in the process of scaffolding out our Microsoft Azure environments using Terraform. While Terraform does an excellent job creating ...
Terraform OSSTL;DR Explicitly using SqlBulkCopy might never cause this problem since mapping is done manually, but NPoco’s usage does automatic map...
NPoco SqlBulkCopyAs you’re building out an API it’s important to keep response times in check. In many cases slowness is due to database calls, web reques...
Benchmarking OSSWe’ve accomplished so much this year thanks to @VueJS that we wanted to give back to the Vue community in some way. Ritter IM is sponsor...
VueJSEgg Fried Rice is a homey dish in China. In this post, I am going to show you my method to make this simple, quick, and delicious dish. E...
Food chinese cuisineAt Ritter Insurance Marketing we utilize Azure Web Apps for hosting many of our web applications. Azure Web Apps is a platform as a servi...
Azure Configuration OSSState management, Redux, Vuex… whatever you want to call it or whatever flavor you use, people have a lot of opinions about it. I’ve writ...
JavaScript VueIf you’re familiar with Vue at all, you’re probably familiar with the v-for. And if you’ve used any other front end frameworks, they each...
JavaScript VueDo you want to save 80% of your bandwidth to your search provider? Do you want to deliver content to your users faster? With this one tr...
Development Elasticsearch DebuggingWe operate in a typical QA -> Production workflow on both our front-end and back-end teams. So, what happnes when your front-end is in...
Development JavaScript Dev Ops Vue Vue.js JekyllIf you’re not familiar, or just haven’t used Sass maps, here’s your chance to dive in. Our latest static site was built on Jekyll using ...
sassIn JavaScript, we are always working with different data types to send to the API or display on the UI. Cloning and altering that clone i...
JavaScriptC# being an Object Oriented Programming (OOP) language, we have access to inheritance. Like any feature of a programming language, you sh...
csharp bugsLet’s say you are developing a new Infinity War
SQL stored procedure. Thanos, your boss, has explicity told you to add validation to a stored procedure and warn developers of their impending doom. To halt the execution of the stored procedure, you may decide to THROW
an exception like so:
;THROW 50001,'I know what it''s like to lose; to feel so desperately that you''re right, yet fail all the same.',1;
Note that the line of SQL throws a 50001
which denotes the error as being user defined. Now, to deal with those developers.
In C#, we can use pattern matching to catch the SqlException
and convert it into a helpful message.
try {
// Execute SQL Command
} catch (SqlException e)
when (e.Number == 50001) {
return new ThanosQuoteResult(e.Message);
}
Note that you want to look at the Number
property on a SqlException
and not the ErrorCode
.