mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(router): preserve error names in minified bundles
`NoMatch` and `AbsoluteRedirect` are thrown from asynchronous contexts, which means error tracking tools often report only the minified constructor name instead of the original class name (for example Rollbar showing just `"t"` as the error type). This change sets an explicit `name` property on both classes so their readable names are preserved at runtime, even after minification.
This commit is contained in:
parent
dfbe7a6ecd
commit
efec72b355
1 changed files with 4 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ import {wrapIntoObservable} from './utils/collection';
|
|||
import {firstValueFrom} from './utils/first_value_from';
|
||||
|
||||
export class NoMatch extends Error {
|
||||
override readonly name = 'NoMatch';
|
||||
|
||||
public segmentGroup: UrlSegmentGroup | null;
|
||||
|
||||
constructor(segmentGroup?: UrlSegmentGroup) {
|
||||
|
|
@ -32,6 +34,8 @@ export class NoMatch extends Error {
|
|||
}
|
||||
|
||||
export class AbsoluteRedirect extends Error {
|
||||
override readonly name = 'AbsoluteRedirect';
|
||||
|
||||
constructor(public urlTree: UrlTree) {
|
||||
super();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue