jevApiException

fun jevApiException(status: Int, body: String? = null, requestId: String? = null, headers: Map<String, List<String>> = emptyMap(), retryAfter: Duration? = null): JevApiException(source)

The JevApiException subclass the client raises for HTTP status, for testing a caller's error handling: 429 gives a JevRateLimitException, 401 a JevAuthenticationException, and so on.

coEvery { jev.evaluate(any(), any(), any()) } throws jevApiException(429, retryAfter = 2.seconds)

A rate-limit error's hint is retryAfter when given, and otherwise read from a retry-after-ms or Retry-After entry in headers, as the client reads it. Java, which can't pass a Duration, sets it through headers. The request id is likewise requestId when given, and otherwise the x-typesafe-request-id entry in headers.