<commit_before>var React = require('react');
var Link = require('react-router').Link;

var userService = require('../services/user');

module.exports = React.createClass({
    getInitialState: function() {
        return {
            users: [],
            query: ''
        };
    },
    componentDidMount: function() {
        var _this = this;
        userService.getList().then(function (users) {
            _this.setState({ users: users });
        });
    },
    handleInputChange: function(event) {
        this.setState({ query: event.target.value });
    },
    render: function() {
        var users = this.state.users;
        var query = this.state.query;
        if(query) {
            users = users.filter(function (user) {
                return user.name.toLowerCase().indexOf(query.toLowerCase()) > -1;
            });
        }

        users = users.slice(0, 20);

        var userNodes = users.map(function (user) {
            return (
                <Link key={user.id} className="user" activeClassName="selected" to={'/user/' + user.id}>
                    <img src={'http://graph.facebook.com/' + user.id + '/picture?type=square'} />
                    <div className="name">{user.name}</div>
                </Link>
            );
        });

        return (
            <div>
                <input className="search" type="text" placeholder="Search" onChange={this.handleInputChange} value={this.state.query}/>
                <div>{userNodes}</div>
            </div>
        );
    }
});
<commit_msg>Handle server exception<commit_after>var React = require('react');
var Link = require('react-router').Link;

var userService = require('../services/user');

module.exports = React.createClass({
    getInitialState: function() {
        return {
            users: [],
            query: ''
        };
    },
    componentDidMount: function() {
        var _this = this;
        userService.getList().then(function (users) {
            _this.setState({ users: users });
        })
        .catch(function(e) {
           console.error('Could not load list of users', e);
        });
    },
    handleInputChange: function(event) {
        this.setState({ query: event.target.value });
    },
    render: function() {
        var users = this.state.users;
        var query = this.state.query;
        if(query) {
            users = users.filter(function (user) {
                return user.name.toLowerCase().indexOf(query.toLowerCase()) > -1;
            });
        }

        users = users.slice(0, 20);

        var userNodes = users.map(function (user) {
            return (
                <Link key={user.id} className="user" activeClassName="selected" to={'/user/' + user.id}>
                    <img src={'http://graph.facebook.com/' + user.id + '/picture?type=square'} />
                    <div className="name">{user.name}</div>
                </Link>
            );
        });

        return (
            <div>
                <input className="search" type="text" placeholder="Search" onChange={this.handleInputChange} value={this.state.query}/>
                <div>{userNodes}</div>
            </div>
        );
    }
});

{'fraction_non_alphanumeric': 0.1563579277864992, 'fraction_numerical': 0.002511773940345369, 'mean_word_length': 1.784965034965035, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2625618', 'n_tokens_mistral': 875, 'n_tokens_neox': 866, 'n_words': 164}