From d723fee177238df0dbab80eb788876ebd154927d Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期四, 24 十月 2024 11:55:46 +0800 Subject: [PATCH] Update HDLLoginInterceptor.java --- HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java new file mode 100644 index 0000000..9793b65 --- /dev/null +++ b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java @@ -0,0 +1,65 @@ +package com.hdl.linkpm.sdk.utils; + +import android.text.TextUtils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.JsonObject; +import com.hdl.linkpm.sdk.core.exception.HDLException; +import com.hdl.linkpm.sdk.core.exception.HDLLinkCopyException; +import com.hdl.log.enums.Level; +import com.hdl.log.utils.LogUtil; + +/** + * Created by Zoro + * Created on 2023/4/7 + * description: + */ +public class HDLExceptionSubmitUtils { + public static void submit(String requestUrl, JsonObject json, HDLException e) { + try { + LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); + } catch (Exception e1) { + + } + } + + public static void submit(String requestUrl, JsonObject json, Throwable e) { + try { + LogUtil.log(requestUrl, "code:" + e.getMessage() + "--msg:" + e.getMessage() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); + } catch (Exception e1) { + + } + } + + public static void submit(String requestUrl, Object json, HDLException e) { + try { + LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); + } catch (Exception e1) { + } + } + + public static void submit(String requestUrl, Object json, HDLLinkCopyException e) { + try { + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(json)); + String utfStr = ""; + if (jsonObject != null) { + try { + byte[] data = jsonObject.getBytes("data"); + utfStr = new String(data); + } catch (Exception e1) { + + } + } + if (!TextUtils.isEmpty(utfStr)) { + LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json) + "--utf-8锛�" + utfStr, null, Level.high); + } else { + LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); + + } + } catch (Exception e1) { + + } + } + +} \ No newline at end of file -- Gitblit v1.8.0