Exceptions
Exceptions are thrown when the Topics service detects a user error or an internal error.
Topics service tasks may throw the following exceptions:
- InvalidArgumentException—Thrown for internal errors if you define invalid information in a field or argument. One example is passing a
TopicsServiceContextargument with a value of null. Another example is requesting actions for a topic ID of -5. Topic IDs must be a number greater than or equal to 0. - TopicsServiceException—Thrown for errors other than
InvalidArgumentException. This includes user input errors. Another example is a semantic error such as getting actions contexts for a topic with an ID that does not exist, or for a topic that was deleted or closed.
These exceptions contain a message field.
The code field contains the HTML code for the error and the status contains the html status:
400 BAD_REQUEST
Other HTML statuses, such as SUCCESS, or AUTHORIZATION FAILURE, may be obtained from the response.
TopicsServiceException value object
{
"errors": [
{
"message": string",
"status": "string",
"code": “integer”
}
]
}
Table 3–3 TopicsServiceException error codes
| Error Code | Description |
|---|---|
|
TOPIC_ERROR_INTERNAL |
Internal error. |
|
TOPIC_ERROR_NO_SERVICE |
Communication error with the topic server. |
|
TOPIC_ERROR_TOPIC_NAME_REQUIRED |
attachNewTopic task called with the topicInput parameter name field not set. |
|
TOPIC_ERROR_ATTACHMENT_NAME_ REQUIRED |
attachTopic, attachNewTopic, or attachAction task called with the attachmentInput parameter name field not set. |
|
TOPIC_ERROR_PROJECT_NAME_REQUIRED |
attachNewTopic task called with topicInput parameternewProject field set but projectName field not set. |
|
TOPIC_ERROR_TOPIC_CLOSED |
attachTopic task called with the topicContext parameter field id set to a closed topic. |
|
TOPIC_ERROR_ACTION_CLOSED |
attachAction task called with the actionContext parameter field id set to a closed action. |
|
TOPIC_ERROR_TOPIC_DELETED |
attachTopic task called with the topicContext parameter field id set to a deleted topic. |
|
TOPIC_ERROR_ACTION_DELETED |
attachAction task called with the actionContext parameter field id set to a deleted action. |
|
TOPIC_ERROR_UNAVAILABLE_TOPIC |
attachTopic task called with the topicContext parameter field id set to a topic that is not available. |
|
TOPIC_ERROR_UNKNOWN_ACTION |
attachAction task called with the actionContext parameter field id set to an action that is not available. |
|
TOPIC_ERROR_UNKNOWN_TOPIC |
Reserved for future use. |
|
TOPIC_ERROR_ATTACHMENT_NAME_LENGTH |
attachTopic, attachNewTopic, or attachAction task called with the attachment name length greater than the maximum length of 255 characters. |
|
TOPIC_ERROR_TOPIC_DESCRIPTION_LENGTH |
attachNewTopic task called with the topic description length greater than the maximum length of 2000 characters. |
|
TOPIC_ERROR_ATTACHMENT_DESCRIPTION_LENGTH |
attachTopic, attachNewTopic, or attachAction task called with the attachment description length greater than the maximum length of 2000 characters. |
|
TOPIC_ERROR_TOPIC_NAME_LENGTH |
attachNewTopic task called with the topic name length greater than the maximum length of 255 characters. |
|
TOPIC_ERROR_PROJECT_LENGTH |
attachNewTopic task called with a new project name length greater than the maximum length of 255 characters. |
|
TOPIC_ERROR_URL_REQUIRED |
attachTopic, attachNewTopic, or attachAction method called with the attachment type of URL and with the AttachmentInput urlAddress empty. |
|
TOPIC_ERROR_URL_LENGTH |
attachTopic, attachNewTopic, or attachAction task called with the attachment type of URL and the AttachmentInput urlAddress greater than the maximum length of 2000 characters. |
|
TOPIC_ERROR_URL_INVALID |
attachTopic, attachNewTopic, or attachAction task called with the attachment type of URL and an invalid format for the AttachmentInput urlAddress. |
|
TOPIC_ERROR_NOTE_REQUIRED |
attachTopic, attachNewTopic, or attachAction task called with the attachment type of Note with the AttachmentInput description empty. |
|
TOPIC_ERROR_NOTE_LENGTH |
attachTopic, attachNewTopic, or attachAction task called with the attachment type of Note and the AttachmentInput description greater than the maximum of 2000 characters. |
|
TOPIC_ERROR_ATTACHMENT_IMAGE_TABLE_NOT_ALLOWED |
attachTopic, attachNewTopic, or attachAction task called when TopicsUserInfo allowedAttachments does not contain IMAGE or TABLE. |
|
TOPIC_ERROR_ATTACHMENT_URL_NOT_ALLOWED |
attachTopic, attachNewTopic, or attachAction task called when TopicsUserInfo allowedAttachments does not contain URL. |
|
TOPIC_ERROR_ATTACHMENT_FILE_NOT_ALLOWED |
attachTopic, attachNewTopic, or attachAction task called when TopicsUserInfo allowedAttachments does not contain FILE. |
|
TOPIC_ERROR_ATTACHMENT_NOTE_NOT_ALLOWED |
attachTopic, attachNewTopic, or attachAction task called when TopicsUserInfo allowedAttachments does not contain NOTE. |
Parent topic: API