mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Use code rather than name for custom error
This commit is contained in:
@@ -283,7 +283,7 @@ class Project extends Model
|
||||
buildBuffer: (absoluteFilePath) ->
|
||||
if fs.getSizeSync(absoluteFilePath) >= 2 * 1048576 # 2MB
|
||||
error = new Error("Atom can only handle files < 2MB for now.")
|
||||
error.name = 'OversizeFileError'
|
||||
error.code = 'EFILETOOLARGE'
|
||||
throw error
|
||||
|
||||
buffer = new TextBuffer({filePath: absoluteFilePath})
|
||||
|
||||
@@ -451,7 +451,7 @@ class Workspace extends Model
|
||||
try
|
||||
item ?= atom.project.open(uri, options)
|
||||
catch error
|
||||
if error.name is 'OversizeFileError'
|
||||
if error.code is 'EFILETOOLARGE'
|
||||
atom.notifications.addWarning(error.message + " Large file support is being tracked at [atom/atom#307](https://github.com/atom/atom/issues/307).")
|
||||
else if error.code is 'ENOENT' and error.path?
|
||||
atom.notifications.addWarning("No such file '#{error.path}'")
|
||||
|
||||
Reference in New Issue
Block a user