Open
Description
Describe the bug
Running a query for the bot name, query results should be in the following format:
{
"status":"success",
"isLoading":false,
"isSuccess":true, // if true, error is null and data populated
"isError":false, // if true, data is null and error populated
"data":"some-botname",
"error": null,
...
}
However, if there is an error getting the botname, it still "succeeds" and sets the error message as the data.
{
"status":"success",
"isLoading":false,
"isSuccess":true,
"isError":false,
"data":"Unable to get botname : Temporary(TimedOut(\"error sending request for url (https://api.telegram.org/bot6374528256:AAGgjZaS_6qnrtZFDGRtu6fFiOsaEiClNSI/getMyName): operation timed out\"))",
// or "data": "Telegram service not configured"
"error": null,
...
}
To Reproduce
Steps to reproduce the behaviour:
- Make telegram inaccessible somehow (remove bot token from local.yaml, disconnect internet connection...)
- Query for telegramBotName
- Receive the error message as the response data
Expected behaviour
botName to be null, with an explanatory error message as to why it is unavailable. We aren't always wanting to throw (bot may not be configured, that is okay)... maybe the success return type could be something like:
{
name: String | null
reason: String | null
}
If there is an actual error, it should come through as an error though?