JSONException.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.qcloud.cmq.Json;
  2. /**
  3. * The JSONException is thrown by the JSON.org classes when things are amiss.
  4. *
  5. * @author JSON.org
  6. * @version 2014-05-03
  7. */
  8. public class JSONException extends RuntimeException {
  9. private static final long serialVersionUID = 0;
  10. private Throwable cause;
  11. /**
  12. * Constructs a JSONException with an explanatory message.
  13. *
  14. * @param message
  15. * Detail about the reason for the exception.
  16. */
  17. public JSONException(String message) {
  18. super(message);
  19. }
  20. /**
  21. * Constructs a new JSONException with the specified cause.
  22. * @param cause The cause.
  23. */
  24. public JSONException(Throwable cause) {
  25. super(cause.getMessage());
  26. this.cause = cause;
  27. }
  28. /**
  29. * Returns the cause of this exception or null if the cause is nonexistent
  30. * or unknown.
  31. *
  32. * @return the cause of this exception or null if the cause is nonexistent
  33. * or unknown.
  34. */
  35. @Override
  36. public Throwable getCause() {
  37. return this.cause;
  38. }
  39. }