Need to add some info in thrown exception

You will need to catch and handle that custom exception somewhere. The standard code knows nothing about this and cannot do anything with it. Where you need to handle the exception will very much depend on the structure of your application and what you’re hoping to do with this data. For example, if it’s in an API response, that’s going to be different than on a web page.