File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 6
6
"use strict" ;
7
7
8
8
const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = require ( "tapable" ) ;
9
- const { makeWebpackError } = require ( "./HookWebpackError" ) ;
9
+ const {
10
+ makeWebpackError,
11
+ makeWebpackErrorCallback
12
+ } = require ( "./HookWebpackError" ) ;
10
13
11
14
/** @typedef {import("./WebpackError") } WebpackError */
12
15
@@ -93,7 +96,12 @@ class Cache {
93
96
* @returns {void }
94
97
*/
95
98
store ( identifier , etag , data , callback ) {
96
- this . hooks . store . callAsync ( identifier , etag , data , callback ) ;
99
+ this . hooks . store . callAsync (
100
+ identifier ,
101
+ etag ,
102
+ data ,
103
+ makeWebpackErrorCallback ( callback , "Cache.hooks.store" )
104
+ ) ;
97
105
}
98
106
99
107
/**
@@ -121,15 +129,19 @@ class Cache {
121
129
* @returns {void }
122
130
*/
123
131
endIdle ( callback ) {
124
- this . hooks . endIdle . callAsync ( callback ) ;
132
+ this . hooks . endIdle . callAsync (
133
+ makeWebpackErrorCallback ( callback , "Cache.hooks.endIdle" )
134
+ ) ;
125
135
}
126
136
127
137
/**
128
138
* @param {Callback<void> } callback signals when the call finishes
129
139
* @returns {void }
130
140
*/
131
141
shutdown ( callback ) {
132
- this . hooks . shutdown . callAsync ( callback ) ;
142
+ this . hooks . shutdown . callAsync (
143
+ makeWebpackErrorCallback ( callback , "Cache.hooks.shutdown" )
144
+ ) ;
133
145
}
134
146
}
135
147
Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ const WebpackError = require("./WebpackError");
9
9
10
10
/** @typedef {import("./Module") } Module */
11
11
12
+ /**
13
+ * @template T
14
+ * @callback Callback
15
+ * @param {Error= } err
16
+ * @param {T= } stats
17
+ * @returns {void }
18
+ */
19
+
12
20
class HookWebpackError extends WebpackError {
13
21
/**
14
22
* Creates an instance of HookWebpackError.
@@ -46,7 +54,7 @@ module.exports.makeWebpackError = makeWebpackError;
46
54
* @template T
47
55
* @param {function(WebpackError=, T=): void } callback webpack error callback
48
56
* @param {string } hook name of hook
49
- * @returns {function(Error=, T=): void } generic callback
57
+ * @returns {Callback<T> } generic callback
50
58
*/
51
59
const makeWebpackErrorCallback = ( callback , hook ) => {
52
60
return ( err , result ) => {
You can’t perform that action at this time.
0 commit comments