<?php

class LegacyDbError extends DB_Error
{
    protected $exception;

    public function __construct(Throwable $exception)
    {
        $this->exception = $exception;

        parent::__construct(
            DB_ERROR,
            PEAR_ERROR_RETURN,
            null,
            null,
            $exception->getMessage()
        );
    }

    public function getMessage()
    {
        return $this->exception->getMessage();
    }
}