<?php

namespace App\Exceptions;

use Exception;

class ContractException extends Exception
{
    public function __construct(string $message = '', int $code = 422, ?Exception $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }

    public function render($request)
    {
        return response()->json([
            'success' => false,
            'message' => $this->getMessage(),
        ], $this->getCode());
    }
}