Class MyPVitException

All Implemented Interfaces:
Serializable

public class MyPVitException extends RuntimeException
Custom exception class for handling API errors in the MyPVit SDK. This exception encapsulates detailed error information returned by the API, such as the status code, error type, and specific field errors. It also provides a custom implementation of getMessage() to construct a detailed error message for logging and debugging purposes. Key Features:
  • Extends RuntimeException, allowing unchecked exceptions to be thrown.
  • Includes additional fields to capture specific error details.
  • Provides a custom getMessage() implementation for detailed error reporting.
See Also:
  • Constructor Details

    • MyPVitException

      public MyPVitException(String message, String date, String statusCode, String error, String path, Set<String> messages, Map<String,String> errors)
      Constructs a new MyPVitException with the specified error details.
      Parameters:
      message - The main error message.
      date - The timestamp of the error.
      statusCode - The HTTP status code of the error.
      error - The type or category of the error.
      path - The API path where the error occurred.
      messages - A set of constraint violation messages.
      errors - A map of field-specific error messages.
  • Method Details

    • getMessage

      public String getMessage()
      Constructs a detailed error message for logging and debugging purposes. The custom error message includes:
      • The main error message.
      • Constraint violation messages, if any.
      • Field-specific error details.
      • General error information, such as status code and API path.
      Overrides:
      getMessage in class Throwable
      Returns:
      A string representation of the error with detailed information.