mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Show GitHub API error message when markdown preview fails
This commit is contained in:
committed by
probablycorey
parent
55d4625091
commit
2944b64795
@@ -32,15 +32,20 @@ class MarkdownPreviewView extends ScrollView
|
||||
getPath: ->
|
||||
@buffer.getPath()
|
||||
|
||||
setErrorHtml: ->
|
||||
setErrorHtml: (result)->
|
||||
try failureMessage = JSON.parse(result.responseText).message
|
||||
|
||||
@html $$$ ->
|
||||
@h2 'Previewing Markdown Failed'
|
||||
@h3 'Possible Reasons'
|
||||
@ul =>
|
||||
@li =>
|
||||
@span 'You aren\'t online or are unable to reach '
|
||||
@a 'github.com', href: 'https://github.com'
|
||||
@span '.'
|
||||
if failureMessage?
|
||||
@h3 failureMessage
|
||||
else
|
||||
@h3 'Possible Reasons'
|
||||
@ul =>
|
||||
@li =>
|
||||
@span 'You aren\'t online or are unable to reach '
|
||||
@a 'github.com', href: 'https://github.com'
|
||||
@span '.'
|
||||
|
||||
setLoading: ->
|
||||
@html($$$ -> @div class: 'markdown-spinner', 'Loading Markdown...')
|
||||
@@ -56,4 +61,4 @@ class MarkdownPreviewView extends ScrollView
|
||||
mode: 'markdown'
|
||||
text: @buffer.getText()
|
||||
success: (html) => @html(html)
|
||||
error: => @setErrorHtml()
|
||||
error: (result) => @setErrorHtml(result)
|
||||
|
||||
Reference in New Issue
Block a user