xref: /dokuwiki/inc/Action/Exception/ActionException.php (revision 0f9e19d90383dd0deb85e1c4ef4750811f102d0f)
1<?php
2
3namespace dokuwiki\Action\Exception;
4
5/**
6 * Class ActionException
7 *
8 * This exception and its subclasses signal that the current action should be
9 * aborted and a different action should be used instead. The new action can
10 * be given as parameter in the constructor. Defaults to 'show'
11 *
12 * The message will NOT be shown to the enduser
13 *
14 * @package dokuwiki\Action\Exception
15 */
16class ActionException extends \Exception {
17
18    protected $newaction;
19
20    /**
21     * ActionException constructor.
22     *
23     * @param string $newaction the action that should be used next
24     * @param string $message optional message, will not be shown except for some dub classes
25     */
26    public function __construct($newaction = 'show', $message = '') {
27        parent::__construct($message);
28        $this->newaction = $newaction;
29    }
30
31    /**
32     * Returns the action to use next
33     *
34     * @return string
35     */
36    public function getNewAction() {
37        return $this->newaction;
38    }
39}
40