You can translate the question and the replies:

Error Handling with Custom Functions

Is there a mechanism by which a custom function can report an error? It appears that exceptions thrown are swallowed and it is treated as though the function returns null.
user
02-09-2020 12:16:42 -0400

6 Answers

Hi, To enable the log for my custom function to log message into the Virtual DataPort server log , I would add the log4j2 library to my project and then defining a logger in my Custom Function class similar as below: ``` import java.util.logging.Logger; public final static Logger LOGGER= Logger.getLogger(CustomConvertFunction.class); ``` Additionally, I can also add the log level to define which messages from custom function should be written to the server log by using a VQL such as “call logcontroller(‘<package>‘, ‘<log level>)” or by editing the [log4j xml](https://community.denodo.com/docs/html/browse/8.0/vdp/administration/appendix/configuring_the_logging_engine/configuring_the_logging_engine)configuration file for the Virtual DataPort server which is available in <DENODO_HOME>/conf/vdp/. For more information, you could refer to the below section, * [Developing Custom Functions](https://community.denodo.com/docs/html/browse/latest/vdp/developer/developing_extensions/developing_custom_functions/developing_custom_functions). * [Using logcontroller and useful log categories](https://community.denodo.com/kb/view/document/Using%20logcontroller%20and%20useful%20log%20categories?category=Operation). Hope this helps!
Denodo Team
03-09-2020 04:24:51 -0400
Thank you! That is wuite helpful from a debug or diagnostics perspective but is there any mechanism to return error state to the caller so that it is visible to a calling application? i know one could return a special value to indicate error but that is less obvious than an error that could terminate a query,
user
03-09-2020 08:28:09 -0400
Hi, I believe that at this point of time, you can debug error by developing the "Custom Functions" but it is not possible to return the error state to any third party application. Hope this helps!
Denodo Team
16-09-2020 01:19:56 -0400
Thanks! That matches what I have been to determine. Any idea of there are plans to add such in a future release?
user
16-09-2020 12:15:04 -0400
Hi, If you have a valid support account and interested in having this feature in the future versions of the Denodo Platform, then I would recommend you to create a support case in the [Denodo Support Site](https://support.denodo.com/) to request this feature. Hope this helps!
Denodo Team
23-09-2020 06:59:33 -0400
Thank you. Our team has submitted a request.
user
23-09-2020 08:46:44 -0400
You must sign in to add an answer. If you do not have an account, you can register here