Package pro.mypvit.exceptions
Class MyPVitException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
pro.mypvit.exceptions.MyPVitException
- All Implemented Interfaces:
Serializable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConstructs a detailed error message for logging and debugging purposes.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MyPVitException
public MyPVitException(String message, String date, String statusCode, String error, String path, Set<String> messages, Map<String, String> errors) Constructs a newMyPVitExceptionwith 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
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:
getMessagein classThrowable- Returns:
- A string representation of the error with detailed information.
-