eventStacktraceException.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import {EventFixture} from 'sentry-fixture/event';
  2. import {EventEntryFixture} from 'sentry-fixture/eventEntry';
  3. import {EntryType} from 'sentry/types/event';
  4. const exception = EventEntryFixture({
  5. type: EntryType.EXCEPTION,
  6. data: {
  7. values: [
  8. {
  9. module: 'example.application',
  10. type: 'Error',
  11. value: 'an error occurred',
  12. stacktrace: {
  13. frames: [
  14. {
  15. function: 'main',
  16. module: 'example.application',
  17. lineNo: 1,
  18. filename: 'application',
  19. inApp: true,
  20. },
  21. {
  22. function: 'doThing',
  23. module: 'example.application',
  24. lineNo: 2,
  25. filename: 'application',
  26. inApp: true,
  27. },
  28. ],
  29. },
  30. },
  31. ],
  32. },
  33. });
  34. const message = {
  35. type: 'message',
  36. data: {
  37. formatted: 'Something is broken',
  38. },
  39. };
  40. const threads = EventEntryFixture({
  41. type: EntryType.THREADS,
  42. data: {
  43. values: [
  44. {
  45. module: 'example.application',
  46. type: 'Error',
  47. value: 'an error occurred',
  48. stacktrace: {
  49. frames: [
  50. {
  51. function: 'main',
  52. module: 'example.application',
  53. lineNo: 1,
  54. filename: 'application',
  55. inApp: true,
  56. },
  57. {
  58. function: 'doThing',
  59. module: 'example.application',
  60. lineNo: 2,
  61. filename: 'application',
  62. inApp: true,
  63. },
  64. ],
  65. },
  66. },
  67. ],
  68. },
  69. });
  70. export function EventStacktraceExceptionFixture(params = {}) {
  71. return EventFixture({entries: [{...exception}], ...params});
  72. }
  73. export function EventStacktraceMessageFixture(params = {}) {
  74. return EventFixture({entries: [{...message}], ...params});
  75. }
  76. export function EventStacktraceThreadsFixture(params = {}) {
  77. return EventFixture({entries: [{...threads}], ...params});
  78. }