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.util.struct.parser; 006 007public class ParseException extends Exception { 008 private final int m_pos; 009 010 public ParseException(int pos, String s) { 011 super(s); 012 m_pos = pos; 013 } 014 015 public ParseException(int pos, String message, Throwable cause) { 016 super(message, cause); 017 m_pos = pos; 018 } 019 020 public ParseException(int pos, Throwable cause) { 021 super(cause); 022 m_pos = pos; 023 } 024 025 public int getPosition() { 026 return m_pos; 027 } 028 029 @Override 030 public String toString() { 031 return m_pos + ": " + getMessage(); 032 } 033}