org.odpi.openmetadata.governanceservers.openlineage.util.OpenLineageExceptionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of open-lineage-services-api Show documentation
Show all versions of open-lineage-services-api Show documentation
Provides the definitions that make up the APIs used by external components when communicating
with the open lineage.
/* SPDX-License-Identifier: Apache-2.0 */
package org.odpi.openmetadata.governanceservers.openlineage.util;
import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler;
import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase;
import org.odpi.openmetadata.governanceservers.openlineage.ffdc.OpenLineageException;
public class OpenLineageExceptionHandler extends RESTExceptionHandler {
public void captureOpenLineageException(FFDCResponseBase response, OpenLineageException e) {
response.setRelatedHTTPCode(e.getReportedHTTPCode());
response.setExceptionClassName(e.getClass().getName());
response.setExceptionErrorMessage(e.getErrorMessage());
response.setExceptionSystemAction(e.getReportedSystemAction());
response.setExceptionUserAction(e.getReportedUserAction());
}
/**
* Throw an detectAndThrowOpenLineageException if it is encoded in the REST response.
*
* @param methodName name of the method called
* @param restResult response from the rest call. This generated in the remote server.
* @throws OpenLineageException encoded exception from the server
*/
public void detectAndThrowOpenLineageException(String methodName,
FFDCResponseBase restResult) throws OpenLineageException {
final String exceptionClassName = OpenLineageException.class.getName();
if ((restResult != null) && (exceptionClassName.equals(restResult.getExceptionClassName()))) {
throw new OpenLineageException(restResult.getRelatedHTTPCode(),
this.getClass().getName(),
methodName,
restResult.getExceptionErrorMessage(),
restResult.getExceptionSystemAction(),
restResult.getExceptionUserAction());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy