eventStacktraceException.js 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {Event} from './event';
  2. const exception = {
  3. type: 'exception',
  4. data: {
  5. values: [
  6. {
  7. module: 'example.application',
  8. type: 'Error',
  9. value: 'an error occurred',
  10. stacktrace: {
  11. frames: [
  12. {
  13. function: 'main',
  14. module: 'example.application',
  15. lineNo: 1,
  16. filename: 'application',
  17. },
  18. {
  19. function: 'doThing',
  20. module: 'example.application',
  21. lineNo: 2,
  22. filename: 'application',
  23. },
  24. ],
  25. },
  26. },
  27. ],
  28. },
  29. };
  30. const message = {
  31. type: 'message',
  32. data: {
  33. formatted: 'Something is broken',
  34. },
  35. };
  36. export function EventStacktraceException(params = {}) {
  37. return Event({entries: [{...exception}], ...params});
  38. }
  39. export function EventStacktraceMessage(params = {}) {
  40. return Event({entries: [{...message}], ...params});
  41. }