Subject:Sending via SFTP returns unexpected exception Author:Bruce Cantor Date:31 Aug 2021 01:19 PM
At my company we would like to exchange information about delivery via sftp as a logfile that can be read by our ERP system.
That way the user will be able to see whether an file has been delivered with success or not.
I therefore thought I would create a xquery script that should write a log file with the result of the transmission in XML format.
The log file is created successfully when the transmission goes well. However it is not possible for me to get it write the log file if anything fails.
The method (ddtekjava:com.ivitechnologies.pipeline.ext.net.SFTP.sendString) unexpectedly throws an exception instead of the expected boolean.
I did a test script, attached to this entry, if I change the login so that the credentials are wrong the script fails with:
[DataDirect][XQuery]Error at line 17, column 27. Error in call to extension function "public static boolean com.ivitechnologies.pipeline.ext.net.SFTP.sendString(org.w3c.dom.Element,java.lang.String,java.lang.String) throws java.lang.Throwable": Exception in extension function "com.jcraft.jsch.JSchException: Auth fail"
Making it impossible to create the failed transmission in a log file.
Is it possible to make a script that handles any errors and at least logs that something went wrong, even better what went wrong?