require('./error-navitem.less'); const React = require('react'); const Nav = require('naturalcrit/nav/nav.jsx'); const createClass = require('create-react-class'); const ErrorNavItem = createClass({ getDefaultProps : function() { return { error : '', parent : null }; }, render : function() { const clearError = ()=>{ const state = { error : null }; if(this.props.parent.state.isSaving) { state.isSaving = false; } this.props.parent.setState(state); }; const error = this.props.error; const response = error.response; const status = response.status; const HBErrorCode = response.body?.HBErrorCode; const message = response.body?.message; let errMsg = ''; try { errMsg += `${error.toString()}\n\n`; errMsg += `\`\`\`\n${error.stack}\n`; errMsg += `${JSON.stringify(response.error, null, ' ')}\n\`\`\``; console.log(errMsg); } catch (e){} if(status === 409) { return Oops!
{message ?? 'Conflict: please refresh to get latest changes'}
; } if(status === 412) { return Oops!
{message ?? 'Your client is out of date. Please save your changes elsewhere and refresh.'}
; } if(HBErrorCode === '04') { return Oops!
You are no longer signed in as an author of this brew! Were you signed out from a different window? Visit our log in page, then try again!

Sign In
Not Now
; } if(response.body?.errors?.[0].reason == 'storageQuotaExceeded') { return Oops!
Can't save because your Google Drive seems to be full!
; } if(response.req.url.match(/^\/api.*Google.*$/m)){ return Oops!
Looks like your Google credentials have expired! Visit our log in page to sign out and sign back in with Google, then try saving again!

Sign In
Not Now
; } if(HBErrorCode === '09') { return Oops!
Looks like there was a problem retreiving the theme, or a theme that it inherits, for this brew. Verify that brew {response.body.brewId} still exists!
; } return Oops!
Looks like there was a problem saving.
Report the issue here .
; } }); module.exports = ErrorNavItem;