Skip to content

telegramBotName query returns error as success data #57

Open
@lache-melvin

Description

@lache-melvin

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:

  1. Make telegram inaccessible somehow (remove bot token from local.yaml, disconnect internet connection...)
  2. Query for telegramBotName
  3. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions