asException
Converts the current AgentServiceError instance into a corresponding AgentEngineException instance.
This function maps the type property of the AgentServiceError to a specific subclass of AgentEngineException based on the error type. Each error type corresponds to a specific exception:
UNEXPECTED_ERRORmaps toUnexpectedServerException.UNEXPECTED_MESSAGE_TYPEmaps toUnexpectedMessageTypeException.MALFORMED_MESSAGEmaps toMalformedMessageException.AGENT_NOT_FOUNDmaps toAgentNotFoundException.
The message property of the AgentServiceError is passed as the exception's message.
Return
An AgentEngineException instance that corresponds to the current error type.