Created
April 28, 2023 16:13
-
-
Save bauefikapa/cb023a460ebe2823a461eebb5dad5e59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const handleResponseErrors = (status: number, errorText: string) => { | |
| if (status === 403 && errorText.toLowerCase().includes("recaptcha")) { | |
| return "There was a verification error, please refresh the page and try asking your question again. If the issue persists please contact support."; | |
| } else if (status === 429 && errorText.includes("User")) { | |
| return "Question limit reached, please wait a few minutes and try again."; | |
| } else if (status === 429 && errorText.includes("Global")) { | |
| return "System capacity reached, please wait a few minutes and try again."; | |
| } else if ([400, 403, 404, 429].includes(status)) { | |
| return "Configuration issue detected, contact support if unresolved shortly."; | |
| } else { | |
| return "There was an unexpected error, please refresh the page and try asking your question again. If the issue persists please contact support."; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment