diff --git a/app/app.js b/app/app.js index 359c3741c..422f330c5 100644 --- a/app/app.js +++ b/app/app.js @@ -227,10 +227,10 @@ app.on('ready', () => { mainWindow.loadURL(`file://${__dirname}/app.html`); if (IS_DEV && IS_MAC) { - BrowserWindow.addDevToolsExtension( - '/Users/gschier/Library/Application Support/Google/Chrome/Default/' + - 'Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.15.0_0' - ); + // BrowserWindow.addDevToolsExtension( + // '/Users/gschier/Library/Application Support/Google/Chrome/Default/' + + // 'Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.15.0_0' + // ); } // Uncomment this to test things diff --git a/app/components/ResponsePane.js b/app/components/ResponsePane.js index fabf1dfdb..c274f9468 100644 --- a/app/components/ResponsePane.js +++ b/app/components/ResponsePane.js @@ -7,10 +7,10 @@ import ResponseViewer from './viewers/ResponseViewer'; import ResponseHeadersViewer from './viewers/ResponseHeadersViewer'; import ResponseCookiesViewer from './viewers/ResponseCookiesViewer'; import {getPreviewModeName} from '../lib/previewModes'; -import {PREVIEW_MODE_SOURCE} from '../lib/previewModes'; import {REQUEST_TIME_TO_SHOW_COUNTER} from '../lib/constants'; import {MOD_SYM} from '../lib/constants'; import {trackEvent} from '../lib/analytics'; +import {PREVIEW_MODE_SOURCE} from '../lib/previewModes'; class ResponsePane extends Component { @@ -156,6 +156,7 @@ class ResponsePane extends Component { editorLineWrapping={editorLineWrapping} editorFontSize={editorFontSize} body={response.error} + error={true} url={response.url} /> ) : ( diff --git a/app/components/base/Link.js b/app/components/base/Link.js index 6e62833e1..2000569dc 100644 --- a/app/components/base/Link.js +++ b/app/components/base/Link.js @@ -2,15 +2,14 @@ import React, {Component, PropTypes} from 'react'; import {shell} from 'electron'; class Link extends Component { - _handleClick (e) { - e.preventDefault(); - shell.openExternal(this.props.href); - } - render () { - const {href, children, ...other} = this.props; - return ( - + const {button, href, children, ...other} = this.props; + return button ? ( + + ) :( + {e.preventDefault(); shell.openExternal(href)}} {...other}> {children} ) @@ -18,7 +17,10 @@ class Link extends Component { } Link.propTypes = { - href: PropTypes.string.isRequired + href: PropTypes.string.isRequired, + + // Optional + button: PropTypes.bool }; export default Link; diff --git a/app/components/viewers/ResponseError.js b/app/components/viewers/ResponseError.js new file mode 100644 index 000000000..909a0b248 --- /dev/null +++ b/app/components/viewers/ResponseError.js @@ -0,0 +1,63 @@ +import React, {Component, PropTypes} from 'react'; + +import Link from '../../components/base/Link'; +import {getModal} from '../modals/index'; +import SettingsModal from '../modals/SettingsModal'; + +class ResponseError extends Component { + render () { + const {error} = this.props; + + let msg = null; + if (error && error.toLowerCase().indexOf('certificate') !== -1) { + msg = ( + + ) + } else if (error && error.toLowerCase().indexOf('getaddrinfo') !== -1) { + msg = ( + + ) + } else { + msg = ( + + View the Docs + + ) + } + + return ( +
+
+ {error} +
+
+
+

+ It looks like you encountered a strange error. Here are some suggestions. +

+ {msg} +    + + Contact Support + +
+
+ ); + } +} + +ResponseError.propTypes = { + error: PropTypes.string.isRequired, + url: PropTypes.string.isRequired +}; + +export default ResponseError; + diff --git a/app/components/viewers/ResponseViewer.js b/app/components/viewers/ResponseViewer.js index 702afdec6..6d9d7c262 100644 --- a/app/components/viewers/ResponseViewer.js +++ b/app/components/viewers/ResponseViewer.js @@ -2,6 +2,7 @@ import React, {Component, PropTypes} from 'react'; import Editor from '../base/Editor'; import ResponseWebview from './ResponseWebview'; +import ResponseError from './ResponseError'; import {PREVIEW_MODE_FRIENDLY, PREVIEW_MODE_SOURCE} from '../../lib/previewModes'; class ResponseViewer extends Component { @@ -22,9 +23,19 @@ class ResponseViewer extends Component { editorLineWrapping, editorFontSize, body, - url + url, + error } = this.props; + if (error) { + return ( + + ) + } + switch (previewMode) { case PREVIEW_MODE_FRIENDLY: return ( @@ -64,7 +75,8 @@ ResponseViewer.propTypes = { url: PropTypes.string.isRequired, // Optional - contentType: PropTypes.string + contentType: PropTypes.string, + error: PropTypes.bool }; export default ResponseViewer; diff --git a/app/containers/WorkspaceDropdown.js b/app/containers/WorkspaceDropdown.js index 589aa424b..a9bebbce9 100644 --- a/app/containers/WorkspaceDropdown.js +++ b/app/containers/WorkspaceDropdown.js @@ -2,7 +2,9 @@ import React, {Component, PropTypes} from 'react'; import {ipcRenderer} from 'electron'; import {bindActionCreators} from 'redux'; import {connect} from 'react-redux' +import {shell} from 'electron'; +import Link from '../components/base/Link'; import Dropdown from '../components/base/Dropdown'; import DropdownDivider from '../components/base/DropdownDivider'; import DropdownHint from '../components/base/DropdownHint'; @@ -128,6 +130,16 @@ class WorkspaceDropdown extends Component { +
  • + + Documentation + +
  • +
  • + + Support + +