Repository: ktorio/ktor
File: ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpCallValidator.kt (Kotlin)

Code before:
 * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig)
 */
@KtorDsl
public class HttpCallValidatorConfig {
    internal val responseValidators: MutableList<ResponseValidator> = mutableListOf()
    internal val responseExceptionHandlers: MutableList<HandlerWrapper> = mutableListOf()

    /**
     * Terminate [HttpClient.receivePipeline] if status code is not successful (>=300).
     */
    internal var expectSuccess: Boolean = true

    /**
     * Add [CallExceptionHandler].
     * Last added handler executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
     */
    public fun handleResponseException(block: CallExceptionHandler) {
        responseExceptionHandlers += ExceptionHandlerWrapper(block)
    }

    /**
     * Add [CallRequestExceptionHandler].
     * Last added handler executes first.
     * @Deprecated("Use handleResponseException(CallExceptionHandler) instead", level = DeprecationLevel.WARNING)

     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
     */
    public fun handleResponseException(block: CallRequestExceptionHandler) {
        responseExceptionHandlers += RequestExceptionHandlerWrapper(block)
    }

    /**
     * Add [CallRequestExceptionHandler].
     * Last added handler executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseExceptionWithRequest)
     */
    public fun handleResponseExceptionWithRequest(block: CallRequestExceptionHandler) {
        responseExceptionHandlers += RequestExceptionHandlerWrapper(block)
    }

    /**
     * Add [ResponseValidator].
     * Last added validator executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.validateResponse)
     */
    public fun validateResponse(block: ResponseValidator) {

Review comment (suggestion):
It seems the annotation `@Deprecated` is misplaced. Also, `ReplaceWith` expression could be added:
```kotlin
/**
 * Add [CallRequestExceptionHandler].
 * Last added handler executes first.
 *
 * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
 */
@Deprecated(
    "Use handleResponseExceptionWithRequest or handleResponseException(CallExceptionHandler) instead",
    ReplaceWith("handleResponseExceptionWithRequest(block)"),
    level = DeprecationLevel.WARNING,
)
public fun handleResponseException(block: CallRequestExceptionHandler) {
```

Code after:
 * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig)
 */
@KtorDsl
public class HttpCallValidatorConfig {
    internal val responseValidators: MutableList<ResponseValidator> = mutableListOf()
    internal val responseExceptionHandlers: MutableList<HandlerWrapper> = mutableListOf()

    /**
     * Terminate [HttpClient.receivePipeline] if status code is not successful (>=300).
     */
    internal var expectSuccess: Boolean = true

    /**
     * Add [CallExceptionHandler].
     * Last added handler executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
     */
    public fun handleResponseException(block: CallExceptionHandler) {
        responseExceptionHandlers += ExceptionHandlerWrapper(block)
    }

    /**
     * Add [CallRequestExceptionHandler].
     * Last added handler executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
     */
    @Deprecated(
        "Use handleResponseExceptionWithRequest or handleResponseException(CallExceptionHandler) instead",
        replaceWith = ReplaceWith("handleResponseExceptionWithRequest(block)"),
        level = DeprecationLevel.WARNING,
    )
    public fun handleResponseException(block: CallRequestExceptionHandler) {
        responseExceptionHandlers += RequestExceptionHandlerWrapper(block)
    }

    /**
     * Add [CallRequestExceptionHandler].
     * Last added handler executes first.
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseExceptionWithRequest)
     */
    public fun handleResponseExceptionWithRequest(block: CallRequestExceptionHandler) {
        responseExceptionHandlers += RequestExceptionHandlerWrapper(block)
    }

    /**
     * Add [ResponseValidator].
     * Last added validator executes first.
     *