Index: Source/devtools/front_end/documentation/DocumentationView.js |
diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js |
index 042f0a243dfb3d91978eae87abf3857b071e2a0b..9866d71bdeb9d75d9f3b440b237421a4c67dcecb 100644 |
--- a/Source/devtools/front_end/documentation/DocumentationView.js |
+++ b/Source/devtools/front_end/documentation/DocumentationView.js |
@@ -22,6 +22,7 @@ WebInspector.DocumentationView.showDocumentationURL = function(url, searchItem) |
if (!WebInspector.DocumentationView._view) |
WebInspector.DocumentationView._view = new WebInspector.DocumentationView(); |
var view = WebInspector.DocumentationView._view; |
+ view.element.removeChildren(); |
WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebInspector.UIString("Documentation"), view); |
view.showDocumentation(url, searchItem); |
} |
@@ -61,14 +62,18 @@ WebInspector.DocumentationView.prototype = { |
return; |
} |
var wikiMarkupText = pages[wikiKeys[0]]["revisions"]["0"]["*"]; |
- var article = WebInspector.JSArticle.parse(wikiMarkupText); |
+ try { |
+ var article = WebInspector.JSArticle.parse(wikiMarkupText); |
+ } catch (error) { |
+ this._createEmptyPage(); |
+ } |
if (!article) { |
this._createEmptyPage(); |
return; |
} |
- var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem); |
this.element.removeChildren(); |
+ var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem); |
this.element.appendChild(renderer.renderJSArticle()); |
}, |
@@ -79,6 +84,15 @@ WebInspector.DocumentationView.prototype = { |
pageTitle.textContent = WebInspector.UIString("Documentation not available"); |
}, |
+ _createPageForError: function(message) |
loislo
2014/09/09 08:05:04
I don't see where you are using it.
iliia
2014/09/09 08:19:28
Done.
|
+ { |
+ this.element.removeChildren(); |
+ var pageTitle = this.element.createChild("div", "documentation-page-title"); |
+ pageTitle.textContent = WebInspector.UIString("We have some problems"); |
+ var error = this.element.createChild("div", "documentation-text"); |
+ error.textContent = WebInspector.UIString("Error message: " + message); |
+ }, |
+ |
__proto__: WebInspector.View.prototype |
} |
@@ -214,7 +228,8 @@ WebInspector.DocumentationView.Renderer.prototype = { |
liveUrl.href = examples[i].liveUrl; |
liveUrl.textContent = WebInspector.UIString("Example"); |
} |
- exampleDescription.appendChild(this._renderBlock(examples[i].description)); |
+ if (examples[i].description) |
+ exampleDescription.appendChild(this._renderBlock(examples[i].description)); |
var code = example.createChild("div", "documentation-example-code"); |
code.classList.add("source-code"); |
code.textContent = examples[i].code; |
@@ -227,7 +242,7 @@ WebInspector.DocumentationView.Renderer.prototype = { |
/** |
* @param {!WebInspector.WikiParser.ArticleElement} article |
- * @return {!Element} |
+ * @return {?Element} |
*/ |
_renderBlock: function(article) |
{ |