~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Controller/Error.php

  • Committer: Dan Garner
  • Date: 2016-06-28 15:02:11 UTC
  • mto: This revision was merged to the branch mainline in revision 528.
  • Revision ID: git-v1:51031805c36c1d366fa330b2c2320d1927c57003
Fixes for upgrade steps

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
use Xibo\Exception\ConfigurationException;
14
14
use Xibo\Exception\FormExpiredException;
15
15
use Xibo\Exception\InstanceSuspendedException;
 
16
use Xibo\Exception\NotFoundException;
16
17
use Xibo\Exception\TokenExpiredException;
17
18
use Xibo\Exception\UpgradePendingException;
18
19
use Xibo\Helper\Translate;
59
60
        if (Translate::GetLocale(2) != '')
60
61
            $this->getDate()->setLocale(Translate::GetLocale(2));
61
62
        
 
63
        // Set up theme
 
64
        \Xibo\Middleware\Theme::setTheme($app);
 
65
 
62
66
        $this->getLog()->debug('Page Not Found. %s', $app->request()->getResourceUri());
63
67
 
64
68
        $message = __('Page not found');
68
72
 
69
73
            case 'web':
70
74
 
71
 
                // Set up theme
72
 
                \Xibo\Middleware\Theme::setTheme($app);
73
 
 
74
75
                if ($app->request()->isAjax()) {
75
76
                    $this->getState()->hydrate([
76
77
                        'success' => false,
126
127
 
127
128
        if ($handled) {
128
129
            $this->getLog()->debug($e->getMessage() . $e->getTraceAsString());
 
130
            $this->getLog()->debug($e->getMessage());
129
131
        }
130
132
        else {
131
133
            // Log the full error
190
192
                $this->getState()->hydrate([
191
193
                    'httpStatus' => $status,
192
194
                    'success' => false,
193
 
                    'message' => (($handled) ? __($e->getMessage()) : __('Unexpected Error, please contact support.')),
194
 
                    'data' => (method_exists($e, 'getErrorData')) ? $e->getErrorData() : []
 
195
                    'message' => (($handled) ? __($e->getMessage()) : __('Unexpected Error, please contact support.'))
195
196
                ]);
196
197
 
197
198
                $this->render();
213
214
        }
214
215
    }
215
216
 
216
 
    /**
217
 
     * Determine if we are a handled exception
218
 
     * @param $e
219
 
     * @return bool
220
 
     */
221
217
    private function handledError($e)
222
218
    {
223
 
        if (method_exists($e, 'handledException'))
224
 
            return $e->handledException();
225
 
 
226
219
        return ($e instanceof \InvalidArgumentException
227
220
            || $e instanceof OAuthException
228
221
            || $e instanceof FormExpiredException
229
222
            || $e instanceof AccessDeniedException
 
223
            || $e instanceof NotFoundException
230
224
            || $e instanceof InstanceSuspendedException
 
225
            || $e instanceof ConfigurationException
231
226
            || $e instanceof UpgradePendingException
232
227
            || $e instanceof TokenExpiredException
233
228
        );