How to use the @sentry/utils.getFunctionName function in @sentry/utils

To help you get started, we’ve selected a few @sentry/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
fill(xhr, 'onreadystatechange', function(original: WrappedFunction): Function {
          const wrapOptions = {
            mechanism: {
              data: {
                function: 'onreadystatechange',
                handler: getFunctionName(original),
              },
              handled: true,
              type: 'instrument',
            },
          };

          // If Instrument integration has been called before TryCatch, get the name of original function
          if (original.__sentry_original__) {
            wrapOptions.mechanism.data.handler = getFunctionName(original.__sentry_original__);
          }

          // Otherwise wrap directly
          return wrap(original, wrapOptions);
        });
      }
github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
fill(xhr, 'onreadystatechange', function(original: WrappedFunction): Function {
          const wrapOptions = {
            mechanism: {
              data: {
                function: 'onreadystatechange',
                handler: getFunctionName(original),
              },
              handled: true,
              type: 'instrument',
            },
          };

          // If Instrument integration has been called before TryCatch, get the name of original function
          if (original.__sentry_original__) {
            wrapOptions.mechanism.data.handler = getFunctionName(original.__sentry_original__);
          }

          // Otherwise wrap directly
          return wrap(original, wrapOptions);
        });
      }
github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
type: 'instrument',
              },
            });
          }
        } catch (err) {
          // can sometimes get 'Permission denied to access property "handle Event'
        }

        return original.call(
          this,
          eventName,
          wrap((fn as any) as WrappedFunction, {
            mechanism: {
              data: {
                function: 'addEventListener',
                handler: getFunctionName(fn),
                target,
              },
              handled: true,
              type: 'instrument',
            },
          }),
          options,
        );
      };
    });
github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
fill(this, prop, original =>
            wrap(original, {
              mechanism: {
                data: {
                  function: prop,
                  handler: getFunctionName(original),
                },
                handled: true,
                type: 'instrument',
              },
            }),
          );
github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
return function(this: any, callback: () => void): () => void {
      return original(
        wrap(callback, {
          mechanism: {
            data: {
              function: 'requestAnimationFrame',
              handler: getFunctionName(original),
            },
            handled: true,
            type: 'instrument',
          },
        }),
      );
    };
  }
github getsentry / sentry-javascript / packages / browser / src / integrations / trycatch.ts View on Github external
return function(this: any, ...args: any[]): number {
      const originalCallback = args[0];
      args[0] = wrap(originalCallback, {
        mechanism: {
          data: { function: getFunctionName(original) },
          handled: true,
          type: 'instrument',
        },
      });
      return original.apply(this, args);
    };
  }