• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NationalBankBelgium / stark / 9205123826

23 May 2024 08:55AM CUT coverage: 88.822%. Remained the same
9205123826

Pull #3800

github

web-flow
Merge 5208cd19f into 59c39b170
Pull Request #3800: chore(deps): bump zone.js from 0.11.8 to 0.14.6 in /showcase

1260 of 1528 branches covered (82.46%)

Branch coverage included in aggregate %.

3770 of 4135 relevant lines covered (91.17%)

193.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/packages/stark-core/src/modules/error-handling/handlers/error-handler.ts
1
import { ErrorHandler, Injectable, Injector } from "@angular/core";
2
import { Store } from "@ngrx/store";
3
import { StarkCoreApplicationState } from "../../../common/store";
4
import { StarkErrorHandlingActions } from "../actions";
5
import { STARK_LOGGING_SERVICE, StarkLoggingService } from "../../logging/services";
6

7
/**
8
 * Replacement for the default {@link https://v12.angular.io/api/core/ErrorHandler|ErrorHandler} from Angular
9
 */
10
@Injectable()
11
export class StarkErrorHandler implements ErrorHandler {
1✔
12
        /**
13
         * @ignore
14
         * @internal
15
         */
16
        private _starkLoggingService?: StarkLoggingService;
17

18
        /**
19
         * @ignore
20
         * @internal
21
         */
22
        private _applicationStore?: Store<StarkCoreApplicationState>;
23

24
        /**
25
         * Class constructor
26
         * @param injector - The Angular injector
27
         */
28
        public constructor(private injector: Injector) {}
62✔
29

30
        /**
31
         * Dispatches an {@link StarkErrorHandlingActions.unhandledError} action which the user can then handle
32
         * @param error - The encountered error
33
         */
34
        public handleError(error: any): void {
35
                this.starkLoggingService.error("StarkErrorHandler: an error has occurred : ", error);
5✔
36
                this.applicationStore.dispatch(StarkErrorHandlingActions.unhandledError({ error }));
×
37
        }
38

39
        /**
40
         * @ignore
41
         * @internal
42
         * @throws When the service is not found (the {@link StarkLoggingService} is not provided in the app).
43
         */
44
        private get starkLoggingService(): StarkLoggingService {
45
                if (typeof this._starkLoggingService === "undefined") {
5✔
46
                        this._starkLoggingService = this.injector.get<StarkLoggingService>(STARK_LOGGING_SERVICE);
5✔
47
                        return this._starkLoggingService;
5✔
48
                }
49

50
                return this._starkLoggingService;
×
51
        }
52

53
        /**
54
         * @ignore
55
         * @internal
56
         * @throws When the Store is not found (the NGRX Store module is not imported in the app).
57
         */
58
        private get applicationStore(): Store<StarkCoreApplicationState> {
59
                if (typeof this._applicationStore === "undefined") {
×
60
                        this._applicationStore = this.injector.get<Store<StarkCoreApplicationState>>(Store);
×
61
                        return this._applicationStore;
×
62
                }
63

64
                return this._applicationStore;
×
65
        }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc