001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.first.wpilibj.util; 009 010/** 011 * Exception for bad status codes from the chip object. 012 */ 013public final class UncleanStatusException extends IllegalStateException { 014 015 private final int m_statusCode; 016 017 /** 018 * Create a new UncleanStatusException. 019 * 020 * @param status the status code that caused the exception 021 * @param message A message describing the exception 022 */ 023 public UncleanStatusException(int status, String message) { 024 super(message); 025 m_statusCode = status; 026 } 027 028 /** 029 * Create a new UncleanStatusException. 030 * 031 * @param status the status code that caused the exception 032 */ 033 public UncleanStatusException(int status) { 034 this(status, "Status code was non-zero"); 035 } 036 037 /** 038 * Create a new UncleanStatusException. 039 * 040 * @param message a message describing the exception 041 */ 042 public UncleanStatusException(String message) { 043 this(-1, message); 044 } 045 046 /** 047 * Create a new UncleanStatusException. 048 */ 049 public UncleanStatusException() { 050 this(-1, "Status code was non-zero"); 051 } 052 053 /** 054 * Create a new UncleanStatusException. 055 * 056 * @return the status code that caused the exception 057 */ 058 public int getStatus() { 059 return m_statusCode; 060 } 061}