您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ErrorEvent.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
  6. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  7. * permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
  10. * Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  14. * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. */
  17. package com.dmdirc.events;
  18. import com.dmdirc.events.eventbus.BaseEvent;
  19. import com.dmdirc.logger.ErrorLevel;
  20. import com.google.common.base.MoreObjects;
  21. public abstract class ErrorEvent extends BaseEvent {
  22. private final ErrorLevel level;
  23. private final Throwable throwable;
  24. private final String message;
  25. private final String details;
  26. public ErrorEvent(final ErrorLevel level,
  27. final Throwable throwable,
  28. final String message,
  29. final String details) {
  30. this.level = level;
  31. this.message = message;
  32. this.throwable = throwable;
  33. this.details = details;
  34. }
  35. public ErrorLevel getLevel() {
  36. return level;
  37. }
  38. public Throwable getThrowable() {
  39. return throwable;
  40. }
  41. public String getMessage() {
  42. return message;
  43. }
  44. public String getDetails() {
  45. return details;
  46. }
  47. @Override
  48. public String toString() {
  49. return MoreObjects.toStringHelper(getClass())
  50. .add("Level", getLevel())
  51. .add("Message", getMessage())
  52. .add("Details", getDetails())
  53. .toString();
  54. }
  55. }