Skip to content

Commit

Permalink
Removed exception constructors no args
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesDuboisSAP committed Sep 3, 2024
1 parent 0616f55 commit 3446bf0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private <T> T executeRequest(
final var client = ApacheHttpClient5Accessor.getHttpClient(destination);
return client.execute(request, new OpenAiResponseHandler<>(responseType));
} catch (final IOException e) {
throw new OpenAiClientException(e);
throw new OpenAiClientException("Request to OpenAI model failed", e);
}
}

Expand All @@ -209,7 +209,7 @@ private <D extends StreamedDelta> Stream<D> streamRequest(
return new OpenAiStreamingHandler<>(deltaType)
.handleResponse(client.executeOpen(null, request, null));
} catch (final IOException e) {
throw new OpenAiClientException(e);
throw new OpenAiClientException("Request to OpenAI model failed", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,8 @@

/** Generic exception for errors occurring when using OpenAI foundation models. */
public class OpenAiClientException extends RuntimeException {
static final String BASE_ERROR_MESSAGE = "Request to OpenAI model failed";
@Serial private static final long serialVersionUID = -7345541120979974432L;

/** Create a new exception with the base message: {@code Request to OpenAI model failed} */
public OpenAiClientException() {
this(BASE_ERROR_MESSAGE);
}

/**
* Create a new exception with the base message: {@code Request to OpenAI model failed}
*
* @param e the cause
*/
public OpenAiClientException(@Nonnull final Exception e) {
this(BASE_ERROR_MESSAGE, e);
}

/**
* Create a new exception with the given message.
*
Expand Down

0 comments on commit 3446bf0

Please sign in to comment.