Custom Java Functions in the Data Mapper - Error Handling Q&A:
Q: I am working on implementing and importing custom Java functions into the Data Mapper and I was wondering how can I find documentation on Error Handling for these custom functions. For example, if there’s a null variable generating a failure, I’d like an email sent out to our engineering team with the error information
A: If we are using a function of any Custom class in Data mapper. Then we need to catch the exception for that function in the code of Custom Class itself. If you have printed the exception after catching it and the mapping fails on that function then the respective exception will be printed in the Error logs and the Kernel logs of Adeptia Suite.
Q: Do I need to change the code for MapperUtilityClass.class in order to catch the errors in the imported Java classes? If so, where do I find the .java file for it?
A: We have already catch the essential errors/exceptions in MapperUtilityClass.class. So there is no need to change it.
Q: Is it recommended to print (System.out.print()) the error messages as well as throwing exceptions? Or just one or the other?
A:There is no need to use System.out.print(). You can use e.printStackTrace for printing the exception in logs and the Data mapping activity will be executed successfully. See below example for more details:
catch (SQLException e)
{
e.printStackTrace();
}
If you want to abort the Data mapping activity when exception is thrown then you can use below throw exception. See example below for more details:
throw new ServiceException("Connection information not available");
Q: Is it possible to tie this together with emails so that our developers can be notified through email when these failures occur?
A: If you want an email notification to be sent to your Developers. Then you can create an email notification activity and attach it to the End Event activity in your Process Flow. Double click on End Event and Set Attach Notification to True. For more details refer section "Creating Miscellaneous Activities>>Book Creating Mail Notification Activity" of Developer Guide.
Q: How are the errors thrown in my Java functions can be caught inside Adeptia. Would it ever show up on the DataMapper GUI? If not, how would we see how it’s handled? Through logs?
A: The errors thrown will not be shown in the DataMapper GUI and can be only seen in logs of Adeptia.
Q:
For the throw statement:
throw new ServiceException("Connection information not available");
Where would this statement be residing? In the Java functions I am importing? It doesn’t recognize ServiceException there, do I need to import it?
A: You need to import the ServiceException by using the below import statement in your Custom Class.
import com.adeptia.indigo.services.ServiceException;
Then use the throw new ServiceException("Connection information not available") inside the catch block.
Comments
0 comments
Article is closed for comments.