<?php

namespace Sibs2;

class sibsException extends \Exception
{
    protected $details;

    public function __construct($details, $log_source = sibsConstants::SIBS_LOG)
    {
        $this->details = $details;
        parent::__construct();

        if (function_exists('wc_get_logger')) {
            wc_get_logger()->error($this->getErrorMessage(), $log_source);
        }
    }

    public function getErrorMessage()
    {
        return "SIBS Error: {$this->details}";
    }
}
