{"id":18336478,"url":"https://github.com/pascaliske/ngx-sentry","last_synced_at":"2025-06-25T15:05:55.339Z","repository":{"id":37587973,"uuid":"159794247","full_name":"pascaliske/ngx-sentry","owner":"pascaliske","description":"Angular ErrorHandler, HttpInterceptor and Service for Sentry.","archived":false,"fork":false,"pushed_at":"2025-03-26T08:33:15.000Z","size":11537,"stargazers_count":15,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T09:35:29.908Z","etag":null,"topics":["angular","error-handling","http-errors","http-interceptor","sentry"],"latest_commit_sha":null,"homepage":"https://pascaliske.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pascaliske.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-30T08:44:07.000Z","updated_at":"2025-03-26T08:32:04.000Z","dependencies_parsed_at":"2023-10-23T19:37:47.018Z","dependency_job_id":"987394ea-533f-431d-95b4-e9b3dc03aba6","html_url":"https://github.com/pascaliske/ngx-sentry","commit_stats":{"total_commits":1687,"total_committers":10,"mean_commits":168.7,"dds":0.4463544754001185,"last_synced_commit":"96fe50e10b948b383d1179bda48d28192cfda8ac"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascaliske%2Fngx-sentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascaliske%2Fngx-sentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascaliske%2Fngx-sentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascaliske%2Fngx-sentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pascaliske","download_url":"https://codeload.github.com/pascaliske/ngx-sentry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247435041,"owners_count":20938530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","error-handling","http-errors","http-interceptor","sentry"],"created_at":"2024-11-05T20:08:03.060Z","updated_at":"2025-04-06T04:35:36.080Z","avatar_url":"https://github.com/pascaliske.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@pascaliske/ngx-sentry`\n\n[![npm (scoped)](https://img.shields.io/npm/v/@pascaliske/ngx-sentry.svg?style=flat-square)](https://www.npmjs.com/package/@pascaliske/ngx-sentry) [![GitHub Tag](https://img.shields.io/github/tag/pascaliske/ngx-sentry.svg?style=flat-square)](https://github.com/pascaliske/ngx-sentry) [![Build Status](https://img.shields.io/github/workflow/status/pascaliske/ngx-sentry/Test%20package/main?label=test\u0026style=flat-square)](https://github.com/pascaliske/ngx-sentry/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT) [![GitHub Last Commit](https://img.shields.io/github/last-commit/pascaliske/ngx-sentry?style=flat-square)](https://github.com/pascaliske/ngx-sentry) [![Awesome Badges](https://img.shields.io/badge/badges-awesome-green.svg?style=flat-square)](https://github.com/Naereen/badges)\n\nThis library provides an [`ErrorHandler`](https://angular.io/api/core/ErrorHandler) and a [`HttpInterceptor`](https://angular.io/guide/http#intercepting-requests-and-responses) for connecting an Angular application with [Sentry](https://sentry.io) service.\n\n## Requirements\n\nTo use this library you need to install the `@sentry/browser` library into your project\n\n```bash\n$ yarn add @sentry/browser\n```\n\n## Installation\n\nTo install the library itself use the following command:\n\n```bash\n$ yarn add @pascaliske/ngx-sentry\n```\n\n## Usage\n\nImport the `provideSentry()` function in your application configuration file. The function expects an object with at least the following two keys: `enabled`, `sentry`. More options can be found in the [`SentryOptions` section](#sentryoptions) below.\n\n```typescript\nimport type { ApplicationConfig } from '@angular/core'\nimport { provideSentry } from '@pascaliske/ngx-sentry'\n\nexport const appConfig: ApplicationConfig = {\n    providers: [\n        provideExperimentalZonelessChangeDetection(),\n        provideSentry({\n            enabled: true,\n            sentry: {\n                dsn: 'https://your-sentry-dsn@sentry.io',\n            },\n        }),\n    ],\n}\n```\n\n## `SentryService`\n\nYou can use the `SentryService` injectable to manually capture errors or events as follows:\n\n```typescript\n@Component({\n    // [...]\n})\nexport class AppComponent {\n    public constructor(private sentryService: SentryService) {}\n\n    public ngOnInit(): void {\n        // capture single error\n        this.sentryService.captureException(new Error(''))\n\n        // capture single error with additional context information\n        this.sentryService.withScope(scope =\u003e {\n            scope.setExtra('currentPage', window.location.href)\n            this.sentryService.captureException(new Error(''))\n        })\n    }\n}\n\n```\n\n\u003e **Note:** The `SentryService` inherits all methods directly from the Sentry library. For more information about their APIs you can visit [their documentation](https://docs.sentry.io/enriching-error-data/context/?platform=browser).\n\n## `SentryOptions`\n\nYou can configure the library for yourself. The possible options for the `provideSentry()` function are:\n\n### enabled\n\nType: `boolean`\u003cbr\u003e\nRequired: `true`\n\nThis flag allows to enable or disable the whole sentry tracking.\n\n### sentry\n\nType: `object`\u003cbr\u003e\nRequired: `true`\n\nConfigure Sentry, see [here](https://docs.sentry.io/error-reporting/quickstart/?platform=browser#configure-the-sdk) for more information.\n\n### dialog\n\nType: `boolean` | [`ReportDialogOptions`](https://docs.sentry.io/enriching-error-data/user-feedback/?platform=browser#customizing-the-widget)\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\nDefault: `false`\n\nEnable or disable the [reporting dialog](https://docs.sentry.io/enriching-error-data/user-feedback/?platform=browser).\n\n### http\n\nType: `object`\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\n\nConfigure the HTTP interceptor.\n\n#### http.enabled\n\nType: `boolean`\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\nDefault: `true`\n\nEnable or disable HTTP intercepting.\n\n#### http.message\n\nType: `string`\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\nDefault: `Http request failed. ({method}, {status}, {url})`\n\nCustomize the captured message for all intercepted HTTP errors. There are a few placeholders which get replaced before sending:\n\n- `{method}` - The request method\n- `{url}` - The requested url\n- `{status}` - The response status\n- `{message}` - The response message\n\n#### http.whitelist\n\nType: `Array\u003cnumber\u003e`\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\nDefault: `null`\n\nUse a whitelist of HTTP status codes to filter the intercepted HTTP requests. Only responses with whitelisted status codes get reported.\n\n#### http.blacklist\n\nType: `Array\u003cnumber\u003e`\u003cbr\u003e\nRequired: `false`\u003cbr\u003e\nDefault: `null`\n\nUse a blacklist of HTTP status codes to filter the intercepted HTTP requests. All responses with blacklisted status codes will be skipped.\n\n## License\n\nMIT © [Pascal Iske](https://pascaliske.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascaliske%2Fngx-sentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpascaliske%2Fngx-sentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascaliske%2Fngx-sentry/lists"}