Creates a new subclass of Exception with an optional detailed message.