Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #1045 #1083

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 6 additions & 9 deletions lib/connectors/sftp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FS from 'fs-plus';
import Path from 'path';
import SSH2 from 'ssh2';
import Connector from '../connector';
import { isGenericUploadError } from '../notifications';
import { traverseTree, statsToPermissions } from '../helpers';

class ConnectorSFTP extends Connector {
Expand Down Expand Up @@ -409,10 +410,7 @@ class ConnectorSFTP extends Connector {
self.mkdir(Path.dirname(fileObject.remotePath).replace(/\\/g, '/'), true, (dirErr) => {
if (dirErr) {
const error = writeErr.message || dirErr;

atom.notifications.addError(`Remote FTP: Upload Error ${error}`, {
dismissable: false,
});
isGenericUploadError(error);

return dirErr;
}
Expand All @@ -421,12 +419,11 @@ class ConnectorSFTP extends Connector {

return true;
});
} else if (err && Object.prototype.hasOwnProperty.call(err, 'message')) {
isGenericUploadError(err.message);
} else {
const error = err.message || writeErr;

atom.notifications.addError(`Remote FTP: Upload Error ${error}`, {
dismissable: false,
});
console.error(writeErr); // Useful for debugging
isGenericUploadError(writeErr);
}
});

Expand Down
7 changes: 7 additions & 0 deletions lib/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,10 @@ export const isNotImplemented = (detail, dismissable = false) => {
dismissable,
});
};

export const isGenericUploadError = (detail, dismissable = false) => {
atom.notifications.addError('Remote FTP: Upload Error.', {
detail,
dismissable,
});
};