mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 11:02:38 +00:00
Merge pull request #4265 from naturalcrit/HandleRequestAbortError
Handle Request Abort Error
This commit is contained in:
@@ -23,14 +23,15 @@ const ErrorNavItem = createClass({
|
|||||||
|
|
||||||
const error = this.props.error;
|
const error = this.props.error;
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const status = response.status;
|
const status = response?.status;
|
||||||
const HBErrorCode = response.body?.HBErrorCode;
|
const errorCode = error.code
|
||||||
const message = response.body?.message;
|
const HBErrorCode = response?.body?.HBErrorCode;
|
||||||
|
const message = response?.body?.message;
|
||||||
let errMsg = '';
|
let errMsg = '';
|
||||||
try {
|
try {
|
||||||
errMsg += `${error.toString()}\n\n`;
|
errMsg += `${error.toString()}\n\n`;
|
||||||
errMsg += `\`\`\`\n${error.stack}\n`;
|
errMsg += `\`\`\`\n${error.stack}\n`;
|
||||||
errMsg += `${JSON.stringify(response.error, null, ' ')}\n\`\`\``;
|
errMsg += `${JSON.stringify(response?.error, null, ' ')}\n\`\`\``;
|
||||||
console.log(errMsg);
|
console.log(errMsg);
|
||||||
} catch (e){}
|
} catch (e){}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.body?.errors?.[0].reason == 'storageQuotaExceeded') {
|
if(response?.body?.errors?.[0].reason == 'storageQuotaExceeded') {
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer' onClick={clearError}>
|
<div className='errorContainer' onClick={clearError}>
|
||||||
@@ -82,7 +83,7 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.req.url.match(/^\/api.*Google.*$/m)){
|
if(response?.req.url.match(/^\/api.*Google.*$/m)){
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer' onClick={clearError}>
|
<div className='errorContainer' onClick={clearError}>
|
||||||
@@ -129,6 +130,18 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(errorCode === 'ECONNABORTED') {
|
||||||
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
|
Oops!
|
||||||
|
<div className='errorContainer' onClick={clearError}>
|
||||||
|
The request to the server was interrupted or timed out.
|
||||||
|
This can happen due to a network issue, or if
|
||||||
|
trying to save a particularly large brew.
|
||||||
|
Please check your internet connection and try again.
|
||||||
|
</div>
|
||||||
|
</Nav.item>;
|
||||||
|
}
|
||||||
|
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer'>
|
<div className='errorContainer'>
|
||||||
|
|||||||
Reference in New Issue
Block a user