Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Prefill issue content for reporting package initialization errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed Feb 3, 2018
1 parent dfaecf6 commit 349526a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/package-initialization-error-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const etch = require('etch')
const {URL} = require('url')
const $ = etch.dom

module.exports =
Expand All @@ -16,7 +17,6 @@ class PackageInitializationErrorComponent {
render () {
return $.div({className: 'PackageInitializationErrorComponent'},
$.h3(null, 'Teletype initialization failed'),
$.p(null, 'Error: ' + this.props.initializationError.message),
$.p(null, 'Make sure your internet connection is working and restart the package.'),
$.div(null,
$.button(
Expand All @@ -31,12 +31,27 @@ class PackageInitializationErrorComponent {
),
$.p(null,
'If the problem persists, visit ',
$.a({href: 'https://github.com/atom/teletype/issues/new', className: 'text-info'}, 'atom/teletype'),
$.a({href: this.getIssueURL(), className: 'text-info'}, 'atom/teletype'),
' and open an issue.'
)
)
}

getIssueURL () {
const {initializationError} = this.props

const url = new URL('https://github.com/atom/teletype/issues/new')
url.searchParams.append('title', 'Package Initialization Error')
url.searchParams.append('body',
'### Diagnostics\n\n' +
'```\n' +
initializationError.diagnosticMessage + '\n' +
'```\n'
)

return url.href
}

async restartTeletype () {
const {packageManager} = this.props
await packageManager.deactivatePackage('teletype')
Expand Down

0 comments on commit 349526a

Please sign in to comment.