src/Api/Client.php
public function handleException($exception)
    {
        //Log the error
        Injector::inst()->get(LoggerInterface::class)->debug($exception->getMessage());
        $request = Injector::inst()->get(HTTPRequest::class);
        $request->getSession()->set('notice', true);
        $request->getSession()->set('noticeType', 'bad');
        $message = $exception->getMessage();
        if ($exception->hasResponse()) {
            $response = json_decode($exception->getResponse()->getBody(), true);
            if (isset($response['error']) && isset($response['error']['message'])) {
                $message = $response['error']['message'];
            }
        }
        $request->getSession()->set('noticeText', $message);
    }
public function handleException($exception)
    {
        //Log the error
        Injector::inst()->get(LoggerInterface::class)->debug($exception->getMessage());
        $request = Injector::inst()->get(HTTPRequest::class);
        $request->getSession()->set('notice', true);
        $request->getSession()->set('noticeType', 'bad');
        $message = $exception->getMessage();
        if ($exception->hasResponse()) {
            $response = json_decode($exception->getResponse()->getBody(), true);
            if (isset($response['error']) && isset($response['error']['message'])) {
                $message = $response['error']['message'];
            }
        }
        $request->getSession()->set('noticeText', $message);
    }
public function handleException ( $ exception ) { //Log the error
 Injector :: inst ( ) -> get ( LoggerInterface :: class ) -> debug ( $ exception -> getMessage ( ) ) ; $ request = Injector :: inst ( ) -> get ( HTTPRequest :: class ) ; $ request -> getSession ( ) -> set ( 'notice' , true ) ; $ request -> getSession ( ) -> set ( 'noticeType' , 'bad' ) ; $ message = $ exception -> getMessage ( ) ; if ( $ exception -> hasResponse ( ) ) { $ response = json_decode ( $ exception -> getResponse ( ) -> getBody ( ) , true ) ; if ( isset ( $ response [ 'error' ] ) && isset ( $ response [ 'error' ] [ 'message' ] ) ) { $ message = $ response [ 'error' ] [ 'message' ] ; } } $ request -> getSession ( ) -> set ( 'noticeText' , $ message ) ; }
Silently handle Hail API HTTP Exception to avoid CMS crashes
Stores error message in a session variable for CMS display

@param \Exception $exception
Silently handle Hail API HTTP Exception to avoid CMS crashes Stores error message in a session variable for CMS display