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

Fix error handling #9

Merged
merged 3 commits into from
Mar 4, 2016
Merged
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
13 changes: 8 additions & 5 deletions src/main/java/org/embulk/output/sftp/SftpFileOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.apache.commons.vfs2.impl.StandardFileSystemManager;
import org.apache.commons.vfs2.provider.sftp.IdentityInfo;
import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder;
import org.embulk.config.ConfigException;
import org.embulk.config.TaskReport;
import org.embulk.spi.Buffer;
import org.embulk.spi.Exec;
Expand Down Expand Up @@ -56,7 +57,7 @@ private StandardFileSystemManager initializeStandardFileSystemManager()
}
catch (FileSystemException e) {
logger.error(e.getMessage());
throw new RuntimeException(e);
throw new ConfigException(e);
}

return manager;
Expand Down Expand Up @@ -87,7 +88,7 @@ private FileSystemOptions initializeFsOptions(PluginTask task)
}
catch (FileSystemException e) {
logger.error(e.getMessage());
throw new RuntimeException(e);
throw new ConfigException(e);
}

return fsOptions;
Expand Down Expand Up @@ -137,7 +138,9 @@ public void add(Buffer buffer)
logger.error(e.getMessage());
Throwables.propagate(e);
}
buffer.release();
finally {
buffer.release();
}
}

@Override
Expand All @@ -161,7 +164,7 @@ public void abort()
@Override
public TaskReport commit()
{
return null;
return Exec.newTaskReport();
}


Expand Down Expand Up @@ -194,7 +197,7 @@ private URI getSftpFileUri(String remoteFilePath)
}
catch (URISyntaxException e) {
logger.error(e.getMessage());
throw new RuntimeException(e);
throw new ConfigException(e);
}
}

Expand Down