src/V2/Endpoint/Guild/RestrictedGuildHandler.php
public function onError(ResponseInterface $response, RequestInterface $request) {
        $json = $this->getResponseAsJson( $response );
        if( !is_null( $json ) && isset( $json->text )) {
            if( $json->text === 'access restricted to guild leaders' ) {
                throw new GuildLeaderRequiredException( $json->text, $response );
            } elseif( $json->text === 'membership required' ) {
                throw new MembershipRequiredException( $json->text, $response );
            }
        }
    }
public function onError(ResponseInterface $response, RequestInterface $request) {
        $json = $this->getResponseAsJson( $response );
        if( !is_null( $json ) && isset( $json->text )) {
            if( $json->text === 'access restricted to guild leaders' ) {
                throw new GuildLeaderRequiredException( $json->text, $response );
            } elseif( $json->text === 'membership required' ) {
                throw new MembershipRequiredException( $json->text, $response );
            }
        }
    }
public function onError ( ResponseInterface $ response , RequestInterface $ request ) { $ json = $ this -> getResponseAsJson ( $ response ) ; if ( ! is_null ( $ json ) && isset ( $ json -> text ) ) { if ( $ json -> text === 'access restricted to guild leaders' ) { throw new GuildLeaderRequiredException ( $ json -> text , $ response ) ; } elseif ( $ json -> text === 'membership required' ) { throw new MembershipRequiredException ( $ json -> text , $ response ) ; } } }
Handle errors by the api.

@param ResponseInterface $response
@param RequestInterface $request

@throws GuildLeaderRequiredException
@throws MembershipRequiredException
Handle errors by the api .