Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add link to Troubleshooting page to Live Preview error messages #8734

Merged
merged 4 commits into from
Sep 16, 2014
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/LiveDevelopment/LiveDevelopment.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ define(function LiveDevelopment(require, exports, module) {
Dialogs.showModalDialog(
Dialogs.DIALOG_ID_ERROR,
Strings.LIVE_DEVELOPMENT_ERROR_TITLE,
Strings.LIVE_DEV_LOADING_ERROR_MESSAGE
_append(Strings.LIVE_DEV_LOADING_ERROR_MESSAGE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small error (the reason the Travis build failed): function should be _appendTroubleshootingMessage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@le717 Thanks! Fixed.

);
})
.always(function () {
Expand Down Expand Up @@ -1042,6 +1042,15 @@ define(function LiveDevelopment(require, exports, module) {
});
}

/**
* Append a message to direct users to the troubleshooting page
* @param {string} msg Original message
* @return {string} Original message plus link to troubleshooting page.
*/
function _appendTroubleshootingMessage(msg) {
return msg + " " + StringUtils.format(Strings.LIVE_DEVELOPMENT_TROUBLESHOOTING, brackets.config.troubleshoot_url);
}

/** Triggered by Inspector.connect */
function _onConnect(event) {
// When the browser navigates away from the primary live document
Expand All @@ -1057,7 +1066,7 @@ define(function LiveDevelopment(require, exports, module) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.LIVE_DEVELOPMENT_ERROR_TITLE,
Strings.LIVE_DEV_LOADING_ERROR_MESSAGE
_appendTroubleshootingMessage(Strings.LIVE_DEV_LOADING_ERROR_MESSAGE)
);
})
.done(_onInterstitialPageLoad);
Expand All @@ -1067,7 +1076,7 @@ define(function LiveDevelopment(require, exports, module) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.LIVE_DEVELOPMENT_ERROR_TITLE,
Strings.LIVE_DEV_NEED_HTML_MESSAGE
_appendTroubleshootingMessage(Strings.LIVE_DEV_NEED_HTML_MESSAGE)
);
_openDeferred.reject();
}
Expand All @@ -1076,7 +1085,7 @@ define(function LiveDevelopment(require, exports, module) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.LIVE_DEVELOPMENT_ERROR_TITLE,
Strings.LIVE_DEV_SERVER_NOT_READY_MESSAGE
_appendTroubleshootingMessage(Strings.LIVE_DEV_SERVER_NOT_READY_MESSAGE)
);
_openDeferred.reject();
}
Expand All @@ -1098,7 +1107,7 @@ define(function LiveDevelopment(require, exports, module) {
var dialogPromise = Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_LIVE_DEVELOPMENT,
Strings.LIVE_DEVELOPMENT_RELAUNCH_TITLE,
Strings.LIVE_DEVELOPMENT_ERROR_MESSAGE,
_appendTroubleshootingMessage(Strings.LIVE_DEVELOPMENT_ERROR_MESSAGE),
[
{
className: Dialogs.DIALOG_BTN_CLASS_LEFT,
Expand Down Expand Up @@ -1166,15 +1175,10 @@ define(function LiveDevelopment(require, exports, module) {
message = StringUtils.format(Strings.ERROR_LAUNCHING_BROWSER, err);
}

// Append a message to direct users to the troubleshooting page.
if (message) {
message += " " + StringUtils.format(Strings.LIVE_DEVELOPMENT_TROUBLESHOOTING, brackets.config.troubleshoot_url);
}

Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_LAUNCHING_BROWSER_TITLE,
message
_appendTroubleshootingMessage(message)
);

_openDeferred.reject("OPEN_LIVE_BROWSER");
Expand Down
4 changes: 2 additions & 2 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ define({

"LIVE_DEVELOPMENT_ERROR_TITLE" : "Live Preview Error",
"LIVE_DEVELOPMENT_RELAUNCH_TITLE" : "Connecting to Browser",
"LIVE_DEVELOPMENT_ERROR_MESSAGE" : "In order for Live Preview to connect, Chrome needs to be relaunched with remote debugging enabled.<br /><br />Would you like to relaunch Chrome and enable remote debugging?",
"LIVE_DEV_LOADING_ERROR_MESSAGE" : "Unable to load Live Preview page",
"LIVE_DEVELOPMENT_ERROR_MESSAGE" : "In order for Live Preview to connect, Chrome needs to be relaunched with remote debugging enabled.<br /><br />Would you like to relaunch Chrome and enable remote debugging?<br /><br />",
"LIVE_DEV_LOADING_ERROR_MESSAGE" : "Unable to load Live Preview page.",
"LIVE_DEV_NEED_HTML_MESSAGE" : "Open an HTML file or make sure there is an index.html file in your project in order to launch live preview.",
"LIVE_DEV_NEED_BASEURL_MESSAGE" : "To launch live preview with a server-side file, you need to specify a Base URL for this project.",
"LIVE_DEV_SERVER_NOT_READY_MESSAGE" : "Error starting up the HTTP server for live preview files. Please try again.",
Expand Down