Skip to content

Commit

Permalink
Merge pull request #8246 from desktop/ku-log-openExternal-errors
Browse files Browse the repository at this point in the history
Log `shell.openExternal` errors
  • Loading branch information
niik committed Oct 1, 2019
2 parents c37efe2 + 06ca5db commit dd78e03
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 17 additions & 11 deletions app/src/main-process/menu/build-default-menu.ts
Expand Up @@ -4,8 +4,6 @@ import { MenuEvent } from './menu-event'
import { truncateWithEllipsis } from '../../lib/truncate-with-ellipsis'
import { getLogDirectoryPath } from '../../lib/logging/get-log-path'
import { ensureDir } from 'fs-extra'

import { log } from '../log'
import { openDirectorySafe } from '../shell'
import { enableRebaseDialog, enableStashing } from '../../lib/feature-flag'
import { MenuLabelsEvent } from '../../models/menu-labels'
Expand Down Expand Up @@ -425,32 +423,40 @@ export function buildDefaultMenu({
const submitIssueItem: Electron.MenuItemConstructorOptions = {
label: __DARWIN__ ? 'Report Issue…' : 'Report issue…',
click() {
shell.openExternal('https://github.com/desktop/desktop/issues/new/choose')
shell
.openExternal('https://github.com/desktop/desktop/issues/new/choose')
.catch(err => log.error('Failed opening issue creation page', err))
},
}

const contactSupportItem: Electron.MenuItemConstructorOptions = {
label: __DARWIN__ ? 'Contact GitHub Support…' : '&Contact GitHub support…',
click() {
shell.openExternal(
`https://github.com/contact?from_desktop_app=1&app_version=${app.getVersion()}`
)
shell
.openExternal(
`https://github.com/contact?from_desktop_app=1&app_version=${app.getVersion()}`
)
.catch(err => log.error('Failed opening contact support page', err))
},
}

const showUserGuides: Electron.MenuItemConstructorOptions = {
label: 'Show User Guides',
click() {
shell.openExternal('https://help.github.com/desktop/guides/')
shell
.openExternal('https://help.github.com/desktop/guides/')
.catch(err => log.error('Failed opening user guides page', err))
},
}

const showKeyboardShortcuts: Electron.MenuItemConstructorOptions = {
label: __DARWIN__ ? 'Show Keyboard Shortcuts' : 'Show keyboard shortcuts',
click() {
shell.openExternal(
'https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop'
)
shell
.openExternal(
'https://help.github.com/en/desktop/getting-started-with-github-desktop/keyboard-shortcuts-in-github-desktop'
)
.catch(err => log.error('Failed opening keyboard shortcuts page', err))
},
}

Expand All @@ -469,7 +475,7 @@ export function buildDefaultMenu({
openDirectorySafe(logPath)
})
.catch(err => {
log('error', err.message)
log.error('Failed opening logs directory', err)
})
},
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main-process/shell.ts
Expand Up @@ -18,7 +18,9 @@ export function openDirectorySafe(path: string) {
slashes: true,
})

shell.openExternal(directoryURL)
shell
.openExternal(directoryURL)
.catch(err => log.error(`Failed to open directory (${path})`, err))
} else {
shell.openItem(path)
}
Expand Down

0 comments on commit dd78e03

Please sign in to comment.