How can i get Service Task's Bpmn Error Activity in Java Delegate

find solotion this issue…

		catch(Exception ex) 
		{
			System.out.println("catch started");
			var ErrorCode = "GlobalError";
			
			var boun = execution.getProcessInstance().getBpmnModelInstance().getModelElementsByType(BoundaryEvent.class);
			for (var item : boun) 
				{
					System.out.println("attachto = " + item.getAttachedTo().getId());
					System.out.println("current ac id = " + execution.getCurrentActivityId());
					if(item.getAttachedTo().getId().equals(execution.getCurrentActivityId())) 
						{
							System.out.println("current ac id = " + execution.getCurrentActivityId());
							var definitions = item.getEventDefinitions();
							for(var def : definitions) 
								{
									if(def.getClass().getSimpleName().equals("ErrorEventDefinitionImpl"))
									{	
											
											ErrorCode = ((ErrorEventDefinition)def).getError().getErrorCode();
											System.out.println("TEXT CONTENT = >  " +((ErrorEventDefinition)def).getTextContent());
											System.out.println("RAWTEXT CONTENT = >  " +((ErrorEventDefinition)def).getRawTextContent());
											System.out.println("errorcode = >  " +((ErrorEventDefinition)def).getError().getErrorCode());
											System.out.println("ERROR CODE = >  " + ErrorCode);
											System.out.println("codevariable " + ((ErrorEventDefinition)def).getCamundaErrorCodeVariable());
											System.out.println("codevariable " + ((ErrorEventDefinition)def).getCamundaErrorMessageVariable());
											break;
									}
								}
						}
				}
			if(ErrorCode.equals("GlobalError")) {
				execution.setVariable("ErrorTaskId", execution.getCurrentActivityId());
			}	
			
			throw new BpmnError(ErrorCode, ex.getMessage());