Skip to content

Commit

Permalink
Return ballerina exception as it is
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Aug 2, 2024
1 parent 2ac9be7 commit 899e40f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package io.ballerina.stdlib.http.api.client.endpoint;

import io.ballerina.runtime.api.values.BDecimal;
import io.ballerina.runtime.api.values.BError;
import io.ballerina.runtime.api.values.BMap;
import io.ballerina.runtime.api.values.BObject;
import io.ballerina.runtime.api.values.BString;
Expand Down Expand Up @@ -156,7 +157,8 @@ public static Object createSimpleHttpClient(BObject httpClient, BMap globalPoolC
httpClient.addNativeData(HttpConstants.CLIENT_ENDPOINT_CONFIG, clientEndpointConfig);
return null;
} catch (Exception ex) {
return HttpUtil.createHttpError(ex.getMessage(), HttpErrorType.GENERIC_CLIENT_ERROR);
return ex instanceof BError ? ex :
HttpUtil.createHttpError(ex.getMessage(), HttpErrorType.GENERIC_CLIENT_ERROR);
}
}

Expand Down

0 comments on commit 899e40f

Please sign in to comment.