001 /*----------------------------------------------------------------------------*/ 002 /* Copyright (c) FIRST 2008-2012. 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 008 package edu.wpi.first.wpilibj.util; 009 010 /** 011 * Exception for bad status codes from the chip object 012 * @author Brian 013 */ 014 public final class UncleanStatusException extends IllegalStateException { 015 016 private final int statusCode; 017 018 /** 019 * Create a new UncleanStatusException 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 statusCode = status; 026 } 027 028 /** 029 * Create a new UncleanStatusException 030 * @param status the status code that caused the exception 031 */ 032 public UncleanStatusException(int status) { 033 this(status, "Status code was non-zero"); 034 } 035 036 /** 037 * Create a new UncleanStatusException 038 * @param message a message describing the exception 039 */ 040 public UncleanStatusException(String message) { 041 this(-1, message); 042 } 043 044 /** 045 * Create a new UncleanStatusException 046 */ 047 public UncleanStatusException() { 048 this(-1, "Status code was non-zero"); 049 } 050 051 /** 052 * Create a new UncleanStatusException 053 * @return the status code that caused the exception 054 */ 055 public int getStatus() { 056 return statusCode; 057 } 058 }