/src/org/ubi/SyntaxError.java

http://github.com/nddrylliog/ooc · Java · 43 lines · 17 code · 7 blank · 19 comment · 0 complexity · 1ee521c7f23c0d3ec2d2e1e35b5a8cb8 MD5 · raw file

  1. package org.ubi;
  2. /**
  3. * A syntax error is at a specific location
  4. *
  5. * @author Amos Wenger
  6. */
  7. public class SyntaxError extends Exception {
  8. /**
  9. *
  10. */
  11. protected static final long serialVersionUID = 4274111704528892881L;
  12. protected FileLocation location;
  13. protected String simpleMessage;
  14. /**
  15. * Create a new syntax error at specified location with specified message
  16. * @param location
  17. * @param message
  18. */
  19. public SyntaxError(FileLocation location, String message) {
  20. super(message+location);
  21. this.location = location;
  22. this.simpleMessage = message;
  23. }
  24. /**
  25. * @return where the error occured in the source
  26. */
  27. public FileLocation getLocation() {
  28. return location;
  29. }
  30. /**
  31. * @return the error message, without the stack trace
  32. */
  33. public String getSimpleMessage() {
  34. return simpleMessage;
  35. }
  36. }