MCPcopy Create free account
hub / github.com/angular/angular / unwrapRedirectCommand

Function unwrapRedirectCommand

packages/router/src/router_error_boundary.ts:25–33  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

23import type {ActivatedRoute} from './router_state';
24
25function unwrapRedirectCommand(error: unknown): RedirectCommand | null {
26 if (error instanceof RedirectCommand) {
27 return error;
28 }
29 if (error && typeof error === 'object' && 'cause' in error) {
30 return unwrapRedirectCommand((error as {cause: unknown}).cause);
31 }
32 return null;
33}
34
35/**
36 * Dispatches a navigation if the given error is (or wraps) a `RedirectCommand`.

Callers 1

triggerRedirectIfCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected