.NET Global Exception Handler to Return Problem Details For Your APIs

This article will focus on handling custom exceptions for flow control on .NET with a global exception handler and return a problem details object.

Having said that. There are, for the most part, two schools of thought. One where it is OK to throw a (custom) exception to control flow. i.e. Throw a UserNotFoundException when a user is not found. The second is implementing the Result Pattern where you return a Success or an Error to control the flow. i.e. Result.UserNotFound.

Continue reading

Solved: GraphQL and Hot Chocolate Workshop issues with the latest versions of Hot Chocolate and .NET Top-Level Statements

I started working on the official “Getting started with GraphQL on ASP.NET Core and Hot Chocolate – Workshop” tutorial, but since the workshop is a bit outdated, it targets .NET 5 and an older version of Hot Chocolate. I am using the latest .NET 7 (at the time of this writing) and top-level statements. In this post, I will address the issues I ran into due to Hot Chocolate version changes from 11 to 13.

Continue reading

Error: Cannot find module ‘gatsby-plugin-utils/polyfill-remote-file’

After updating Gatsby from 3.0.4 to 4.12.1 I got the following error message: Error: Cannot find module 'gatsby-plugin-utils/polyfill-remote-file' and the stack trace below:

$ NODE_OPTIONS="-r esm" gatsby develop -H 0.0.0.0 -o
/Users/esausilva/Development/Projects/andreasilva-design/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

/Users/esausilva/Development/Projects/andreasilva-design/node_modules/gatsby/dist/utils/start-server.js:1
Error: Cannot find module 'gatsby-plugin-utils/polyfill-remote-file'
Require stack:
- /Users/esausilva/Development/Projects/andreasilva-design/node_modules/gatsby/dist/utils/start-server.js
...
Continue reading