更改Angular环境配置以使用指定的构建环境进行Sentry错误处理

问题描述

我在Angular应用程序中具有Sentry的基本配置,目前,Sentry项目的环境基于environment.production布尔变量的通用值设置为生产或开发,该变量对于所有环境配置都是通用的,如下所示:

src / app / handlers / sentry-err-handler.ts

Sentry.init({
  release: '***@1.0.0',environment: environment.production ? 'production' : 'development',dsn:
    'https://***',// TryCatch has to be configured to disable XMLHttpRequest wrapping,as we are going to handle
  // http module exceptions manually in Angular's ErrorHandler and we don't want it to capture the same error twice.
  // Please note that TryCatch configuration requires at least @sentry/browser v5.16.0.
  integrations: [
    new Sentry.Integrations.TryCatch({
      XMLHttpRequest: false,}),],});

src\environments\environment.stage.ts

export const environment = {
  production: true,name: 'staging',auth0: {
    domain: '***',clientId: '*',responseType: 'token id_token',audience: 'https://***',requestedScopes: 'openid profile',database: 'Username-Password-Authentication',},};

现在,我拥有的环境配置不仅仅是生产或开发,例如在这种情况下,我拥有舞台环境。如何更改此逻辑以使Sentry项目中的环境与我的角度应用程序中的环境相同?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)