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](https://private-user-images.githubusercontent.com/17516896/270745388-3d984523-a1c3-463e-be84-07540ba673f8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE2Mjg2MTYsIm5iZiI6MTcyMTYyODMxNiwicGF0aCI6Ii8xNzUxNjg5Ni8yNzA3NDUzODgtM2Q5ODQ1MjMtYTFjMy00NjNlLWJlODQtMDc1NDBiYTY3M2Y4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIyVDA2MDUxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhZTZkYjYyOTYxNWRjNGM1ZWU0MjU4ZWUyNDMwODM0Njg1MTAwMGY0MjQxNTcwZjg1MTc4YzMwMDRkMzVmZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YNY-UZyuhYkv5Zeom7oTeu_kBNOo_qUkfwMNPfLSJZg)
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
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']