I haven’t found any attributes in camunda modeler to define a error by setting the type of java class to handle bpmn error as per mentioned in docs.
I think this can be equal to modelling the Error start event in event sub process.
Yeah exactly .
If we set Java Class as Errorcode, then no need to set Errorcode variable & Error message variable?
Error code variable and error message variable are optional settings. You can use them to make the error code and message available as process variables once the error event has triggered. Check the following link for details: https://docs.camunda.org/manual/7.10/reference/bpmn20/events/error-events/#error-boundary-event. In the case of a Java exception, the error code is the class name and the error message is the exception message.
All that said, it looks like the error code variables does not work correctly in this case, for which I have raised an issue: https://app.camunda.com/jira/browse/CAM-9745