修改异常包装策略:运行时异常不包装,只包装非运行时异常

This commit is contained in:
Looly
2023-08-08 19:03:56 +08:00
parent d5ac761f08
commit cd53378ae3
35 changed files with 155 additions and 92 deletions

View File

@@ -12,6 +12,7 @@
package org.dromara.hutool.http.client.engine.jdk;
import org.dromara.hutool.core.io.IORuntimeException;
import org.dromara.hutool.core.io.IoUtil;
import org.dromara.hutool.core.net.url.UrlBuilder;
import org.dromara.hutool.core.text.StrUtil;
@@ -79,7 +80,7 @@ public class JdkClientEngine implements ClientEngine {
} catch (final IOException e) {
// 出错后关闭连接
IoUtil.closeQuietly(this);
throw new RuntimeException(e);
throw new IORuntimeException(e);
}
return sendRedirectIfPossible(message, isAsync);

View File

@@ -557,7 +557,7 @@ public class JakartaServletUtil {
writer.write(text);
writer.flush();
} catch (final IOException e) {
throw new HutoolException(e);
throw new IORuntimeException(e);
} finally {
IoUtil.closeQuietly(writer);
}

View File

@@ -568,7 +568,7 @@ public class ServletUtil {
writer.write(text);
writer.flush();
} catch (final IOException e) {
throw new HutoolException(e);
throw new IORuntimeException(e);
} finally {
IoUtil.closeQuietly(writer);
}