Skip to content

Commit df7bc3b

Browse files
author
Caitlin Bales (MSFT)
committed
Update error for custom requests
1 parent 391df63 commit df7bc3b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/com/microsoft/graph/http/BaseRequest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ public URL getRequestUrl() {
153153
try {
154154
return new URL(uriBuilder.build().toString());
155155
} catch (final MalformedURLException e) {
156-
throw new ClientException("Invalid URL: " + uriBuilder.toString(), e);
156+
if (this instanceof CustomRequest) {
157+
this.getClient().getLogger().logError("Invalid custom URL: " + uriBuilder.toString(), e);
158+
} else {
159+
throw new ClientException("Invalid URL: " + uriBuilder.toString(), e);
160+
}
157161
}
162+
return null;
158163
}
159164

160165
private String addFunctionParameters() {

src/main/java/com/microsoft/graph/requests/extensions/CustomRequestBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
import com.microsoft.graph.models.extensions.GraphServiceClient;
99
import com.microsoft.graph.options.Option;
1010

11+
/**
12+
* The class for the CustomRequestBuilder
13+
*
14+
* @throws ClientException If the provided URL is malformed, the client exception will contain a MalformedURLException
15+
*/
1116
public class CustomRequestBuilder extends BaseRequestBuilder {
1217
public final Class responseType;
1318

0 commit comments

Comments
 (0)