Is there a way to get the error code that was thrown from the service task in Camunda v 7.2?

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.6/org/camunda/bpm/engine/delegate/BpmnError.html#BpmnError(java.lang.String,%20java.lang.String)

public BpmnError(String errorCode, String message)

Use the errorCode as your generic thrown error, and the errorMessage as the specific error content you want to parse on. You can do all of this with a single bpmn error event.

edit:

and if you want to do multiple error events, here is a example using 7.6:

This is the output parameter of a service task with http-connector:

if (statusCode == 401){
   throw new org.camunda.bpm.engine.delegate.BpmnError("MailGun401", response);
} else if (statusCode == 400){
   throw new org.camunda.bpm.engine.delegate.BpmnError("MailGun400", response);
} else {
   S(response);
}

and the diagram snippet: