All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.hologres.client.impl.util.ExceptionUtil Maven / Gradle / Ivy

There is a newer version: 2.5.5
Show newest version
/*
 * Copyright (c) 2023. Alibaba Group Holding Limited
 */

package com.alibaba.hologres.client.impl.util;

import com.alibaba.hologres.client.exception.HoloClientException;
import com.alibaba.hologres.client.exception.HoloClientWithDetailsException;

/**
 * 异常相关工具类.
 */
public class ExceptionUtil {
	/**
	 * 当a和b同为HoloClientWithDetailsException时,将b合并入a对象,否则返回任何一个异常.
	 *
	 * @param a
	 * @param b
	 * @return
	 */
	public static HoloClientException merge(HoloClientException a, HoloClientException b) {
		if (a == null) {
			return b;
		} else if (b == null) {
			return a;
		} else if (a instanceof HoloClientWithDetailsException) {
			if (b instanceof HoloClientWithDetailsException) {
				((HoloClientWithDetailsException) a).merge((HoloClientWithDetailsException) b);
				return a;
			} else {
				return b;
			}
		} else {
			return a;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy