thatfiredev / Tocha

[DEPRECATED] 🔥 Full-Text Search for Firebase Projects that use the Spark (Free) plan.
MIT License
9 stars 0 forks source link

Improve responses #7

Closed thatfiredev closed 5 years ago

thatfiredev commented 5 years ago

Seems like when an error occurs while processing the requests, the project simply returns an empty array as response. And if the query returns no matches, we also get the same response. So there's no way to tell whether a request was successful or not.

I suggest adding fields that provides us with status message and status code so that we know if the request was successful. And if it wasn't, what error was thrown.

Proposal:

{
  "response": {
    "result": [], // the array of responses
    "isSuccessful": true, // boolean indicating weather the request succeeded or not
    "errorMessage": "something happened" // message indicating what error occurred or null
  }
}