<commit_before><?php

namespace Cms\CoreBundle\Controller;

require_once 'pipestack-sdk-php-master/sdk/PipeStackFactory.php';

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DevelopersController extends Controller {

    public function indexAction()
    {
        return $this->renderNode('intro');
    }

    public function basicsAction()
    {
        return $this->renderNode('basics');
    }

    public function responsesAction()
    {
        return $this->renderNode('responses');
    }

    public function exceptionsAction()
    {
        return $this->renderNode('exceptions');
    }

    public function endpointNodesAction()
    {
        return $this->renderNode('nodes');
    }

    public function endpointMediaAction()
    {
        return $this->renderNode('media');
    }

    public function renderNode($docName)
    {
        $pipestack = \PipeStackFactory::build('Prod');
        $response = $pipestack->get('nodes?slug=docs/'.$docName);
        $nodes = $response->nodes;
        return $this->render('CmsCoreBundle:Developers:index.html.twig', array('node' => $nodes[0], 'doc' => $docName));

    }

}<commit_msg>added try catch to api call<commit_after><?php

namespace Cms\CoreBundle\Controller;

require_once 'pipestack-sdk-php-master/sdk/PipeStackFactory.php';

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DevelopersController extends Controller {

    public function indexAction()
    {
        return $this->renderNode('intro');
    }

    public function basicsAction()
    {
        return $this->renderNode('basics');
    }

    public function responsesAction()
    {
        return $this->renderNode('responses');
    }

    public function exceptionsAction()
    {
        return $this->renderNode('exceptions');
    }

    public function endpointNodesAction()
    {
        return $this->renderNode('nodes');
    }

    public function endpointMediaAction()
    {
        return $this->renderNode('media');
    }

    public function renderNode($docName)
    {
        $pipestack = \PipeStackFactory::build('Prod');
        try{
            $response = $pipestack->get('nodes?slug=docs/'.$docName);
        }catch(\PipeStackException $e){
            throw new \Exception($e->getMessage());
        }
        $nodes = $response->nodes;
        return $this->render('CmsCoreBundle:Developers:index.html.twig', array('node' => $nodes[0], 'doc' => $docName));

    }

}
{'fraction_non_alphanumeric': 0.1378323108384458, 'fraction_numerical': 0.0008179959100204499, 'mean_word_length': 2.98371335504886, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1457923', 'n_tokens_mistral': 722, 'n_tokens_neox': 697, 'n_words': 123}