1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.Hook = void 0;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | const Callable_1 = require("../Callable");
|
16 |
|
17 |
|
18 |
|
19 | class Hook {
|
20 | constructor(_resolveFn, _fn, _hookLifecycle) {
|
21 | this._resolveFn = _resolveFn;
|
22 | this._fn = _fn;
|
23 | this._hookLifecycle = _hookLifecycle;
|
24 | }
|
25 | |
26 |
|
27 |
|
28 |
|
29 | async run() {
|
30 | try {
|
31 | await (0, Callable_1.Callable)(this._resolveFn, this._fn, 0);
|
32 | }
|
33 | catch (error) {
|
34 | error.lifecycle = this._hookLifecycle;
|
35 | error.fnName = this._fn.name;
|
36 | throw error;
|
37 | }
|
38 | }
|
39 | }
|
40 | exports.Hook = Hook;
|