I’m working on error handling and want to be sure I’m covering some bases to provide more suitable user-facing error messaging. In doing so, I’ve noticed what appears to be some inconsistency in how the API responds to mutations on text inputs.
Namely, I’ve compared three mutations:
- create_workspace
- create_board
- create_item
Sample input (length: 256): abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv
- Create a workspace
The workspace is created given the sample input with no error response (200 nor non-200). However, the workspace’s name is silently truncated to 255 characters.
- Create a board
The board is unable to be created, throwing a CreateBoardException
(400).
{
"error_code": "CreateBoardException",
"status_code": 400,
"error_message": "Failed to create board",
"error_data": {}
}
- Create an item
The item is unable to be created, throwing an ItemNameTooLongException
(200).
{
"error_code": "ItemNameTooLongException",
"status_code": 200,
"error_message": "item_name is too long. Item names must be below 256 characters.",
"error_data": {
"item_name": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv"
}
}
So, my questions are:
- Shouldn’t workspace creation throw an exception? While the workspace was indeed created, it was not created with the query specified.
- Creating a board and creating an item both failed for the same reason: the name exceeded 255 characters. So, why the different status codes?