ff14-advanced-market-search / saddlebag-with-pockets

This is the Frontend for the FF14 Marketplace

Home Page:https://saddlebagexchange.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to show exceptions from /api/recipelookup when using craftsim

cohenaj194 opened this issue · comments

So theres a problem we are allowing users to go outside the given parameters of a search

image

From the first api this results in the error

{
    "exception": "Median sale price and max_material_cost must be at least 100 gil"
}

However this is not displayed on the fe. In fact not only can you select 0 (which you should not be able to do) but it also shows no error when you hit search.

We need the exceptions from the first api to be displayed if exception is in the response.

Have you got a list of min / max values for each of the inputs?

Have you got a list of min / max values for each of the inputs?

You can look in the file

https://github.com/ff14-advanced-market-search/Aetheryte/blob/dev/api/functions/ffxiv_recipe_lookup.py#L25-L41

But really the fix here should be raising an error on the frontend when the first api has an exception instead of just taking the output no matter what it is and sending it to the 2nd api

taking the response from the first api and sending it over without checking it will only cause errors like this one

[9][2023-09-26 10:34:36,825] [app] [ERROR] ['home_server', 'cost_metric', 'revenue_metric', 'crafting_list_nq', 'crafting_list_hq', 'max_material_cost']
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/app/app.py", line 329, in get_ffxivcraftsim
    verify_typing(kwargs, get_type_hints(get_ffxiv_craftsim))
  File "/app/app.py", line 122, in verify_typing
    raise MissingParameters(missing_params)
api.utils.exceptions.MissingParameters: ['home_server', 'cost_metric', 'revenue_metric', 'crafting_list_nq', 'crafting_list_hq', 'max_material_cost']
[9][2023-09-26 10:34:37,447] [app] [INFO] /api/wow/itemnames params: {'item_ids': [], 'return_all': False, 'pets': False, 'df_only': False}
[9][2023-09-26 10:34:38,247] [helpers] [INFO] Time elapsed for get_item_names: 0.7994414250133559 seconds
[8][2023-09-26 10:34:41,059] [app] [ERROR] ['home_server', 'cost_metric', 'revenue_metric', 'crafting_list_nq', 'crafting_list_hq', 'max_material_cost']
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/app/app.py", line 329, in get_ffxivcraftsim
    verify_typing(kwargs, get_type_hints(get_ffxiv_craftsim))
  File "/app/app.py", line 122, in verify_typing
    raise MissingParameters(missing_params)
api.utils.exceptions.MissingParameters: ['home_server', 'cost_metric', 'revenue_metric', 'crafting_list_nq', 'crafting_list_hq', 'max_material_cost']