eventStacktraceException.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {EntryType} from 'sentry/types';
  2. import {Event} from './event';
  3. import {EventEntry} from './eventEntry';
  4. const exception = EventEntry({
  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. export function EventStacktraceException(params = {}) {
  41. return Event({entries: [{...exception}], ...params});
  42. }
  43. export function EventStacktraceMessage(params = {}) {
  44. return Event({entries: [{...message}], ...params});
  45. }