001/*----------------------------------------------------------------------------*/
002/* Copyright (c) 2008-2018 FIRST. 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  private final int m_statusCode;
015
016  /**
017   * Create a new UncleanStatusException.
018   *
019   * @param status  the status code that caused the exception
020   * @param message A message describing the exception
021   */
022  public UncleanStatusException(int status, String message) {
023    super(message);
024    m_statusCode = status;
025  }
026
027  /**
028   * Create a new UncleanStatusException.
029   *
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   *
039   * @param message a message describing the exception
040   */
041  public UncleanStatusException(String message) {
042    this(-1, message);
043  }
044
045  /**
046   * Create a new UncleanStatusException.
047   */
048  public UncleanStatusException() {
049    this(-1, "Status code was non-zero");
050  }
051
052  /**
053   * Create a new UncleanStatusException.
054   *
055   * @return the status code that caused the exception
056   */
057  public int getStatus() {
058    return m_statusCode;
059  }
060}