Remove save error reporting from Workspace

This commit is contained in:
Kevin Sawicki
2015-02-05 14:43:45 -08:00
parent 3850550345
commit 477801ba52

View File

@@ -609,7 +609,7 @@ class Workspace extends Model
# {::saveActivePaneItemAs} # will be called instead. This method does nothing
# if the active item does not implement a `.save` method.
saveActivePaneItem: ->
@saveActivePaneItemAndReportErrors('saveActiveItem')
@getActivePane().saveActiveItem()
# Prompt the user for a path and save the active pane item to it.
#
@@ -617,27 +617,7 @@ class Workspace extends Model
# `.saveAs` on the item with the selected path. This method does nothing if
# the active item does not implement a `.saveAs` method.
saveActivePaneItemAs: ->
@saveActivePaneItemAndReportErrors('saveActiveItemAs')
saveActivePaneItemAndReportErrors: (method) ->
try
@getActivePane()[method]()
catch error
if error.message.endsWith('is a directory')
atom.notifications.addWarning("Unable to save file: #{error.message}")
else if error.code is 'EACCES' and error.path?
atom.notifications.addWarning("Unable to save file: Permission denied '#{error.path}'")
else if error.code is 'EPERM' and error.path?
atom.notifications.addWarning("Unable to save file '#{error.path}'", detail: error.message)
else if error.code is 'EBUSY' and error.path?
atom.notifications.addWarning("Unable to save file '#{error.path}'", detail: error.message)
else if error.code is 'EROFS' and error.path?
atom.notifications.addWarning("Unable to save file: Read-only file system '#{error.path}'")
else if errorMatch = /ENOTDIR, not a directory '([^']+)'/.exec(error.message)
fileName = errorMatch[1]
atom.notifications.addWarning("Unable to save file: A directory in the path '#{fileName}' could not be written to")
else
throw error
@getActivePane().saveActiveItemAs()
# Destroy (close) the active pane item.
#