Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add api errors #9

Closed
Laurick opened this issue Feb 23, 2024 · 1 comment
Closed

[Feature]: Add api errors #9

Laurick opened this issue Feb 23, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Laurick
Copy link
Contributor

Laurick commented Feb 23, 2024

Description

In order to get more information about the failure flow at the api calls we need to return an error object with the information parsed to app

Current Behavior

The api client returns nulls with no information about the error itself.

How

Since Godot is not static typed we can use it to return an response ( like an 'ok' for timeouts) or an object error (VSTError?) with the following params:

  • errorCode:int - Usefull to track errors and pick out easly
  • errorDescription:String - A human readeable description in english

In the other hand if we took this aproach every response from the api must be casted to response or the error class. I think that add a lot of overhead so we can:

  1. Parse all the responses to objects that will inherit from another one called VSTError and only check the errorCode ( much faster and ligther )
  2. Refactor a little bit the api script to add in every call 2 Callables one to be called when the api call was success and the other when the call was a failure ( Example -> "func add_vip(user_to_vip_id: String, on_success_callback:Callable = null, on_failure_callback:Callable = null)")
  3. Make a big refactor and make a "ApiRequest" class and using Builder pattern to add all the data and the callbacks.
@Laurick Laurick added the enhancement New feature or request label Feb 23, 2024
@rothiotome
Copy link
Owner

I think this should be our first priorioty right now. We don't control any API call and it's a problem if the supposed flow fails. Let's work on this right now

@rothiotome rothiotome mentioned this issue Feb 23, 2024
8 tasks
@Laurick Laurick mentioned this issue Feb 27, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants