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

Show an error message when trying to rename a file outside of the project #12234

Merged
merged 2 commits into from
Mar 31, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
changing to switch case
  • Loading branch information
arun bose committed Mar 31, 2016
commit 18c2e0b4f491c7a794e4c214ddfc71809d1dd3aa
23 changes: 11 additions & 12 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,19 +1320,18 @@ define(function (require, exports, module) {
// because some errors can come up synchronously and then the dialog
// is not displayed.
window.setTimeout(function () {
if (errorInfo.type === ProjectModel.ERROR_INVALID_FILENAME) {
switch (errorInfo.type) {
case ProjectModel.ERROR_INVALID_FILENAME:
_showErrorDialog(ERR_TYPE_INVALID_FILENAME, errorInfo.isFolder, ProjectModel._invalidChars);
} else {
var errString;
if (errorInfo.type === FileSystemError.ALREADY_EXISTS) {
errString = Strings.FILE_EXISTS_ERR;
} else if (errorInfo.type === ProjectModel.ERROR_NOT_IN_PROJECT) {
errString = Strings.ERROR_RENAMING_NOT_IN_PROJECT;
} else {
errString = FileUtils.getFileErrorString(errorInfo.type);
}

_showErrorDialog(ERR_TYPE_RENAME, errorInfo.isFolder, errString, errorInfo.fullPath);
break;
case FileSystemError.ALREADY_EXISTS:
_showErrorDialog(ERR_TYPE_RENAME, errorInfo.isFolder, Strings.FILE_EXISTS_ERR, errorInfo.fullPath);
break;
case ProjectModel.ERROR_NOT_IN_PROJECT:
_showErrorDialog(ERR_TYPE_RENAME, errorInfo.isFolder, Strings.ERROR_RENAMING_NOT_IN_PROJECT, errorInfo.fullPath);
break;
default:
_showErrorDialog(ERR_TYPE_RENAME, errorInfo.isFolder, FileUtils.getFileErrorString(errorInfo.type), errorInfo.fullPath);
}
}, 10);
d.reject(errorInfo);
Expand Down