Class MotorNoExceptionThrown

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.chatmotorapi.api.util.exception.MotorNoExceptionThrown
All Implemented Interfaces:
Serializable

public class MotorNoExceptionThrown
extends Exception
MotorNoExceptionThrown is a custom exception class used to indicate that no actual exception was thrown. This class helps to ensure that methods like MotorResponse#getThrowable() never return null values, providing a more robust and predictable error handling mechanism.

By using this class, ChatMotor maintains a consistent approach to error handling, making it easier for developers to handle errors without the need to check for null values.

Example usage:

 
 if (response.isResponseOk()) {
     // Handle successful response
 } else {
     Throwable error = response.getThrowable();
     if (error instanceof MotorNoExceptionThrown) {
         // Handle the case where no actual exception was thrown
     } else {
         // Handle the actual exception
     }
 }
 
 
See Also:
Serialized Form
  • Constructor Details

    • MotorNoExceptionThrown

      public MotorNoExceptionThrown()
      Constructs a new MotorNoExceptionThrown exception with a default message indicating that no exception was thrown.