protected static function process_curl_exception($token, $curloutput) {
        if (!isset($curloutput['exception'])) {
            return;
        }
        if ($token === registration::get_token()) {
            // Check if registration token was rejected or there are other problems with registration.
            if (($curloutput['exception'] === 'moodle_exception' && $curloutput['errorcode'] === 'invalidtoken')
                    || $curloutput['exception'] === 'registration_exception') {
                // Force admin to repeat site registration process.
                registration::reset_token();
                throw new moodle_exception('errorwstokenreset', 'hub', '', $curloutput['message']);
            }
        }
        throw new moodle_exception('errorws', 'hub', '', $curloutput['message']);
    }
protected static function process_curl_exception($token, $curloutput) {
        if (!isset($curloutput['exception'])) {
            return;
        }
        if ($token === registration::get_token()) {
            // Check if registration token was rejected or there are other problems with registration.
            if (($curloutput['exception'] === 'moodle_exception' && $curloutput['errorcode'] === 'invalidtoken')
                    || $curloutput['exception'] === 'registration_exception') {
                // Force admin to repeat site registration process.
                registration::reset_token();
                throw new moodle_exception('errorwstokenreset', 'hub', '', $curloutput['message']);
            }
        }
        throw new moodle_exception('errorws', 'hub', '', $curloutput['message']);
    }
protected static function process_curl_exception ( $ token , $ curloutput ) { if ( ! isset ( $ curloutput [ 'exception' ] ) ) { return ; } if ( $ token === registration :: get_token ( ) ) { // Check if registration token was rejected or there are other problems with registration. if ( ( $ curloutput [ 'exception' ] === 'moodle_exception' && $ curloutput [ 'errorcode' ] === 'invalidtoken' ) || $ curloutput [ 'exception' ] === 'registration_exception' ) { // Force admin to repeat site registration process. registration :: reset_token ( ) ; throw new moodle_exception ( 'errorwstokenreset' , 'hub' , '' , $ curloutput [ 'message' ] ) ; } } throw new moodle_exception ( 'errorws' , 'hub' , '' , $ curloutput [ 'message' ] ) ; }
Analyses exception received from moodle.net

@param string $token token used for CURL request
@param array $curloutput output from CURL request
@throws moodle_exception
Analyses exception received from moodle . net