1<?php
2
3namespace MaxMind\Exception;
4
5/**
6 * Thrown when a MaxMind web service returns an error relating to the request.
7 */
8class InvalidRequestException extends HttpException
9{
10    /**
11     * The code returned by the MaxMind web service.
12     */
13    private $error;
14
15    /**
16     * @param string     $message    the exception message
17     * @param int        $error      the error code returned by the MaxMind web service
18     * @param int        $httpStatus the HTTP status code of the response
19     * @param string     $uri        the URI queries
20     * @param \Exception $previous   the previous exception, if any
21     */
22    public function __construct(
23        $message,
24        $error,
25        $httpStatus,
26        $uri,
27        \Exception $previous = null
28    ) {
29        $this->error = $error;
30        parent::__construct($message, $httpStatus, $uri, $previous);
31    }
32
33    public function getErrorCode()
34    {
35        return $this->error;
36    }
37}
38