<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.usfirst.frc2877.AerialAssist2014Robot.subsystems;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.can.CANTimeoutException;
import org.usfirst.frc2877.AerialAssist2014Robot.Robot;

/**
 *
 * @author Administrator
 * 
 * Helper class for managing a CAN-based Jaguar
 * 
 * 
 */
public class CANJag {
    public CANJaguar m_jag;
    public double m_voltage;
    public double m_current;
    public String m_description;
    public String m_lasterror = null;
    public boolean m_status = false;
    
    public CANJag(int jagnum, String descr) {
        m_description = descr;
        System.out.print("CAN init " + jagnum + " " + descr);
        try {
            m_jag = new CANJaguar(jagnum);
            System.out.println(" OK");
        } catch (CANTimeoutException ex) {
            m_lasterror = ex.getMessage();
            System.out.println(" FAILED: " + m_lasterror);
            m_status = false;
        }
        m_status = true;
    }
    
    public CANJaguar getJag()
    {
        return m_jag;
    }
    
    public double getVoltage()
    {
        try {
            m_voltage = m_jag.getOutputVoltage();
        } catch  (CANTimeoutException ex) {
            m_lasterror = ex.getMessage();
            System.out.println(m_lasterror + " " + m_description);
            m_status = false;
            return 0.0;
        }
        return m_voltage;
    }
    
    public double getCurrent() {            
        try {
            m_current = m_jag.getOutputCurrent();
        } catch  (CANTimeoutException ex) {
            m_lasterror = ex.getMessage();
            System.out.println(m_lasterror + " " + m_description);
            m_status = false;
            return 0.0;
        }
        m_status = true;
        return m_current;
    }
    
    public boolean getStat() {
        return m_status;
    }
    
    public String getDescr() {
        return m_description;
    }
            
}

<commit_msg>Catch more exceptions in CANJag<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.usfirst.frc2877.AerialAssist2014Robot.subsystems;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.can.CANTimeoutException;
import org.usfirst.frc2877.AerialAssist2014Robot.Robot;

/**
 *
 * @author Administrator
 * 
 * Helper class for managing a CAN-based Jaguar
 * 
 * 
 */
public class CANJag {
    public CANJaguar m_jag;
    public double m_voltage;
    public double m_current;
    public String m_description;
    public String m_lasterror = null;
    public boolean m_status = false;
    
    public CANJag(int jagnum, String descr) {
        m_description = descr;
        System.out.print("CAN init " + jagnum + " " + descr);
        try {
            m_jag = new CANJaguar(jagnum);
            System.out.println(" OK");
        } catch (Exception ex) {
            m_lasterror = ex.getMessage();
            System.out.println(" FAILED: " + m_lasterror);
            m_status = false;
        }
        m_status = true;
    }
    
    public CANJaguar getJag()
    {
        return m_jag;
    }
    
    public double getVoltage()
    {
        try {
            m_voltage = m_jag.getOutputVoltage();
        } catch  (Exception ex) {
            m_lasterror = ex.getMessage();
            System.out.println(m_lasterror + " " + m_description);
            m_status = false;
            return 0.0;
        }
        return m_voltage;
    }
    
    public double getCurrent() {            
        try {
            m_current = m_jag.getOutputCurrent();
        } catch  (Exception ex) {
            m_lasterror = ex.getMessage();
            System.out.println(m_lasterror + " " + m_description);
            m_status = false;
            return 0.0;
        }
        m_status = true;
        return m_current;
    }
    
    public boolean getStat() {
        return m_status;
    }
    
    public String getDescr() {
        return m_description;
    }
            
}


{'fraction_non_alphanumeric': 0.09411196911196912, 'fraction_numerical': 0.009652509652509652, 'mean_word_length': 1.8527185134205093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1464242', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1312, 'n_words': 282}