milestonexprotectwspython.xpwwebserviceexception

Module: xpwwebserviceexception.py

Revision History

Date Version Description
2023/07/11 1.0.0.0 Initial Version.

@export
class XPWWebServiceException(milestonexprotectwspython.xpwexception.XPWException):

Raised when the XProtect Web server returns an error response to a web service call.

XPWWebServiceException( message: str, errorText: str, errorTextId: str, propertyName: str, httpCode: int, httpReason: str, logsi: smartinspectpython.sisession.SISession = None)

Initializes a new instance of the class.

Arguments:
  • message (str): Exception message text.
  • errorText (str): Error text that describes the error.
  • errorTextId (str): Error text unique identifier that describes the error.
  • propertyName (str): Property name that caused the error.
  • httpCode (str): HTTP status code of the error.
  • httpReason (str): HTTP reason for the error.
  • logsi (SISession): Trace session object that this exception will be logged to, or null to bypass trace logging.
MSG_SERVICE_FAILURE: str = '\nXProtect Web Service Failure Details:\nStatus Code: {0} - {1}\nError Text: {2}\nError ID: {3}\nProperty: {4}\n'

Web Service failure details message text, in the form of:

XProtect Web Service Failure Details: Status Code: {0} - {1} Error Text: {2} Error ID: {3} Property: {4}

ErrorText: str

Error text that describes the error. This value is parsed from the XProtext web-service response "errorText" value.

Returns:

The ErrorText property value.

ErrorTextId: str

Error text unique identifier that describes the error.
This value is parsed from the XProtext web-service response "errorTextId" value. This is normally only populated for HTTP status code 400 (Bad Request) errors.

Returns:

The ErrorTextId property value.

HttpCode: int

HTTP status code of the error. This value is copied from the HTTP Response "status_code" value.

Returns:

The HttpCode property value.

HttpReason: str

HTTP reason for the error. This value is copied from the HTTP Response "reason" value.

Returns:

The HttpReason property value.

PropertyName: str

Property name that caused the error.
This value is parsed from the XProtext web-service response "propertyName" value. This is normally only populated for HTTP status code 400 (Bad Request) errors.

Returns:

The PropertyName property value.

@staticmethod
def FormatServiceFailureDetails( errorText: str, errorTextId: str, propertyName: str, httpCode: int, httpReason: str) -> str:

Returns a formatted message that describes the service failure; this includes the error text, error text id, http code, http reason, message, and property name.

Arguments:
  • errorText (str): Error text that describes the error.
  • errorTextId (str): Error text unique identifier that describes the error.
  • propertyName (str): Property name that caused the error.
  • httpCode (str): HTTP status code of the error.
  • httpReason (str): HTTP reason for the error.
Returns:

A formatted string representation of the object.