001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.hal.util; 006 007/** Exception for bad status codes from the chip object. */ 008public final class UncleanStatusException extends IllegalStateException { 009 private final int m_statusCode; 010 011 /** 012 * Create a new UncleanStatusException. 013 * 014 * @param status the status code that caused the exception 015 * @param message A message describing the exception 016 */ 017 public UncleanStatusException(int status, String message) { 018 super(message); 019 m_statusCode = status; 020 } 021 022 /** 023 * Create a new UncleanStatusException. 024 * 025 * @param status the status code that caused the exception 026 */ 027 public UncleanStatusException(int status) { 028 this(status, "Status code was non-zero"); 029 } 030 031 /** 032 * Create a new UncleanStatusException. 033 * 034 * @param message a message describing the exception 035 */ 036 public UncleanStatusException(String message) { 037 this(-1, message); 038 } 039 040 /** Create a new UncleanStatusException. */ 041 public UncleanStatusException() { 042 this(-1, "Status code was non-zero"); 043 } 044 045 /** 046 * Create a new UncleanStatusException. 047 * 048 * @return the status code that caused the exception 049 */ 050 public int getStatus() { 051 return m_statusCode; 052 } 053}