diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java b/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java index 4277c277b6..e4452d9610 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java @@ -578,7 +578,10 @@ public static BError createHttpError(Throwable throwable) { IOUtils.getIOPackage()); return createHttpError("Something wrong with the connection", HttpErrorType.GENERIC_CLIENT_ERROR, cause); } else if (throwable instanceof ClientConnectorException) { - return HttpUtil.createHttpStatusCodeError(CLIENT_CONNECTOR_ERROR, "Something wrong with the connection"); + cause = createErrorCause(throwable.getMessage(), IOConstants.ErrorCode.GenericError.errorCode(), + IOUtils.getIOPackage()); + return HttpUtil.createHttpStatusCodeError(CLIENT_CONNECTOR_ERROR, "Something wrong with the connection", + null, cause); } else if (throwable instanceof NullPointerException) { return createHttpError("Exception occurred: null", HttpErrorType.GENERIC_CLIENT_ERROR, createHttpError(throwable.toString()));