1<?php
2
3namespace dokuwiki\plugin\struct\meta;
4
5/**
6 * Class StructException
7 *
8 * A translatable exception
9 *
10 * @package dokuwiki\plugin\struct\meta
11 */
12class StructException extends \RuntimeException
13{
14
15    protected $trans_prefix = 'Exception ';
16
17    /**
18     * StructException constructor.
19     *
20     * @param string $message
21     * @param ...string $vars
22     */
23    public function __construct($message)
24    {
25        /** @var \helper_plugin_struct $plugin */
26        $plugin = plugin_load('helper', 'struct');
27        $trans = $plugin->getLang($this->trans_prefix . $message);
28        if (!$trans) $trans = $message;
29
30        $args = func_get_args();
31        array_shift($args);
32
33        $trans = vsprintf($trans, $args);
34
35        parent::__construct($trans, -1, null);
36    }
37}
38