xref: /dokuwiki/inc/Action/Exception/ActionException.php (revision e8aa673904585abd734c81035797cc5bdbe28182)
164ab5140SAndreas Gohr<?php
264ab5140SAndreas Gohr
364ab5140SAndreas Gohrnamespace dokuwiki\Action\Exception;
464ab5140SAndreas Gohr
5*e8aa6739SAndreas Gohr/**
6*e8aa6739SAndreas Gohr * Class ActionException
7*e8aa6739SAndreas Gohr *
8*e8aa6739SAndreas Gohr * This exception and its subclasses signal that the current action should be
9*e8aa6739SAndreas Gohr * aborted and a different action should be used instead. The new action can
10*e8aa6739SAndreas Gohr * be given as parameter in the constructor. Defaults to 'show'
11*e8aa6739SAndreas Gohr *
12*e8aa6739SAndreas Gohr * The message will NOT be shown to the enduser
13*e8aa6739SAndreas Gohr *
14*e8aa6739SAndreas Gohr * @package dokuwiki\Action\Exception
15*e8aa6739SAndreas Gohr */
1664ab5140SAndreas Gohrclass ActionException extends \Exception {
1764ab5140SAndreas Gohr
1864ab5140SAndreas Gohr    protected $newaction;
1964ab5140SAndreas Gohr
20*e8aa6739SAndreas Gohr    /**
21*e8aa6739SAndreas Gohr     * ActionException constructor.
22*e8aa6739SAndreas Gohr     *
23*e8aa6739SAndreas Gohr     * @param string $newaction the action that should be used next
24*e8aa6739SAndreas Gohr     * @param string $message optional message, will not be shown except for some dub classes
25*e8aa6739SAndreas Gohr     */
2664ab5140SAndreas Gohr    public function __construct($newaction = 'show', $message = '') {
2764ab5140SAndreas Gohr        parent::__construct($message);
2864ab5140SAndreas Gohr        $this->newaction = $newaction;
2964ab5140SAndreas Gohr    }
3064ab5140SAndreas Gohr
31*e8aa6739SAndreas Gohr    /**
32*e8aa6739SAndreas Gohr     * Returns the action to use next
33*e8aa6739SAndreas Gohr     *
34*e8aa6739SAndreas Gohr     * @return string
35*e8aa6739SAndreas Gohr     */
3664ab5140SAndreas Gohr    public function getNewAction() {
3764ab5140SAndreas Gohr        return $this->newaction;
3864ab5140SAndreas Gohr    }
3964ab5140SAndreas Gohr}
40