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

Commit e65b81b

Browse files
author
Narciso Jaramillo
committed
Merge pull request #7787 from adobe/pflynn/encoding-error-string
More specific error message when non-UTF-8 files opened
2 parents 71267e3 + 45ad989 commit e65b81b

4 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/file/FileUtils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ define(function (require, exports, module) {
160160
result = Strings.NO_MODIFICATION_ALLOWED_ERR_FILE;
161161
} else if (name === FileSystemError.CONTENTS_MODIFIED) {
162162
result = Strings.CONTENTS_MODIFIED_ERR;
163+
} else if (name === FileSystemError.UNSUPPORTED_ENCODING) {
164+
result = Strings.UNSUPPORTED_ENCODING_ERR;
163165
} else {
164166
result = StringUtils.format(Strings.GENERIC_ERROR, name);
165167
}

src/filesystem/FileSystemError.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ define(function (require, exports, module) {
3939
INVALID_PARAMS : "InvalidParams",
4040
NOT_FOUND : "NotFound",
4141
NOT_READABLE : "NotReadable",
42+
UNSUPPORTED_ENCODING : "UnsupportedEncoding",
4243
NOT_SUPPORTED : "NotSupported",
4344
NOT_WRITABLE : "NotWritable",
4445
OUT_OF_SPACE : "OutOfSpace",

src/filesystem/impls/appshell/AppshellFileSystem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ define(function (require, exports, module) {
160160
case appshell.fs.ERR_CANT_WRITE:
161161
return FileSystemError.NOT_WRITABLE;
162162
case appshell.fs.ERR_UNSUPPORTED_ENCODING:
163-
return FileSystemError.NOT_READABLE;
163+
return FileSystemError.UNSUPPORTED_ENCODING;
164164
case appshell.fs.ERR_OUT_OF_SPACE:
165165
return FileSystemError.OUT_OF_SPACE;
166166
case appshell.fs.ERR_FILE_EXISTS:

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ define({
3737
"NO_MODIFICATION_ALLOWED_ERR" : "The target directory cannot be modified.",
3838
"NO_MODIFICATION_ALLOWED_ERR_FILE" : "The permissions do not allow you to make modifications.",
3939
"CONTENTS_MODIFIED_ERR" : "The file has been modified outside of {APP_NAME}.",
40+
"UNSUPPORTED_ENCODING_ERR" : "The file is not UTF-8 encoded text.",
4041
"FILE_EXISTS_ERR" : "The file or directory already exists.",
4142
"FILE" : "file",
4243
"DIRECTORY" : "directory",

0 commit comments

Comments
 (0)