What are industry standard best practices for implementing custom exceptions in C#?

The standard for creating custom exceptions is to derive from Exception. You can then introduce your own properties/methods and overloaded constructors (if applicable). Here is a basic example of a custom ConnectionFailedException which takes in an extra parameter which is specific to the type of exception. [Serializable] public class ConnectionFailedException : Exception { public ConnectionFailedException(string … Read more

Oracle PL/SQL – Raise User-Defined Exception With Custom SQLERRM

Yes. You just have to use the RAISE_APPLICATION_ERROR function. If you also want to name your exception, you’ll need to use the EXCEPTION_INIT pragma in order to associate the error number to the named exception. Something like SQL> ed Wrote file afiedt.buf 1 declare 2 ex_custom EXCEPTION; 3 PRAGMA EXCEPTION_INIT( ex_custom, -20001 ); 4 begin … Read more