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

Maybe handle odd exceptions in verify_typing

cohenaj194 opened this issue · comments

So the frontend doesnt handle exceptions when we find something in verify_typing. This will produce a list of elements from whats wrong:

Screen.Recording.2023-11-17.at.2.33.49.PM.mov
image image

The frontend cant handle this and only shows a response when elements is a string

image

However I'm not 100% sure we should have the FE tell people whats wrong, we dont want to point people in the right direction (i.e. tell people we are detecting their sql injection). Maybe if the elements is a list just tell people This request is invalid, please screenshot your input and contact us on discord to resolve the issue.

If you changed the error response type then the front end will need updating.

Have you thought of changing the responses to be REST responses?

If you changed the error response type then the front end will need updating.

Have you thought of changing the responses to be REST responses?

Yea maybe I should do that and actually try to follow best practices

One thing we could do is uniform all responses to have a response of :
{ success: true, data: {...} } {.success: false, error: string }
Then you can have a dictionary of error strings you return.
And we can have a file we can reference and use and keep up to date:
{ invalid_input: "Required input missing or wrongly formatted", default_error: "Unknown problem occurred", }
Then you just need to return the error key to the frontend and we can determine how specific each error needs to be