Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log shell.openExternal errors #8246

Merged
merged 7 commits into from Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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