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 org.wpilib.driverstation; 006 007import org.wpilib.driverstation.internal.DriverStationBackend; 008 009/** Provides access to error and warning reporting functionality to the Driver Station. */ 010public final class DriverStationErrors { 011 private DriverStationErrors() {} 012 013 /** 014 * Report error to Driver Station. Optionally appends Stack trace to error message. 015 * 016 * @param error The error to report. 017 * @param printTrace If true, append stack trace to error string 018 */ 019 public static void reportError(String error, boolean printTrace) { 020 DriverStationBackend.reportError(error, printTrace); 021 } 022 023 /** 024 * Report error to Driver Station. Appends provided stack trace to error message. 025 * 026 * @param error The error to report. 027 * @param stackTrace The stack trace to append 028 */ 029 public static void reportError(String error, StackTraceElement[] stackTrace) { 030 DriverStationBackend.reportError(error, stackTrace); 031 } 032 033 /** 034 * Report warning to Driver Station. Optionally appends Stack trace to warning message. 035 * 036 * @param warning The warning to report. 037 * @param printTrace If true, append stack trace to warning string 038 */ 039 public static void reportWarning(String warning, boolean printTrace) { 040 DriverStationBackend.reportWarning(warning, printTrace); 041 } 042 043 /** 044 * Report warning to Driver Station. Appends provided stack trace to warning message. 045 * 046 * @param warning The warning to report. 047 * @param stackTrace The stack trace to append 048 */ 049 public static void reportWarning(String warning, StackTraceElement[] stackTrace) { 050 DriverStationBackend.reportWarning(warning, stackTrace); 051 } 052}