| 
									
										
										
										
											2017-03-25 05:17:47 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Jarid Margolin @jaridmargolin | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-25 05:17:47 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-06 17:27:56 +08:00
										 |  |  | const inspect = require("util").inspect.custom; | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | const makeSerializable = require("./util/makeSerializable"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 01:29:12 +08:00
										 |  |  | /** @typedef {import("./Chunk")} Chunk */ | 
					
						
							| 
									
										
										
										
											2018-07-14 03:30:55 +08:00
										 |  |  | /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ | 
					
						
							| 
									
										
										
										
											2020-01-21 05:36:47 +08:00
										 |  |  | /** @typedef {import("./Module")} Module */ | 
					
						
							| 
									
										
										
										
											2023-04-12 02:57:43 +08:00
										 |  |  | /** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ | 
					
						
							|  |  |  | /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ | 
					
						
							| 
									
										
										
										
											2018-07-14 03:30:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | class WebpackError extends Error { | 
					
						
							| 
									
										
										
										
											2018-05-07 14:19:41 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * Creates an instance of WebpackError. | 
					
						
							|  |  |  | 	 * @param {string=} message error message | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-04-06 13:59:58 +08:00
										 |  |  | 	constructor(message) { | 
					
						
							|  |  |  | 		super(message); | 
					
						
							| 
									
										
										
										
											2018-04-08 08:44:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 00:44:28 +08:00
										 |  |  | 		this.details = undefined; | 
					
						
							| 
									
										
										
										
											2020-01-21 05:36:47 +08:00
										 |  |  | 		/** @type {Module} */ | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | 		this.module = undefined; | 
					
						
							| 
									
										
										
										
											2018-07-14 03:30:55 +08:00
										 |  |  | 		/** @type {DependencyLocation} */ | 
					
						
							|  |  |  | 		this.loc = undefined; | 
					
						
							| 
									
										
										
										
											2018-10-25 16:49:51 +08:00
										 |  |  | 		/** @type {boolean} */ | 
					
						
							|  |  |  | 		this.hideStack = undefined; | 
					
						
							| 
									
										
										
										
											2018-12-19 01:29:12 +08:00
										 |  |  | 		/** @type {Chunk} */ | 
					
						
							|  |  |  | 		this.chunk = undefined; | 
					
						
							|  |  |  | 		/** @type {string} */ | 
					
						
							|  |  |  | 		this.file = undefined; | 
					
						
							| 
									
										
										
										
											2018-04-06 13:59:58 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-06 17:27:56 +08:00
										 |  |  | 	[inspect]() { | 
					
						
							| 
									
										
										
										
											2017-03-25 05:17:47 +08:00
										 |  |  | 		return this.stack + (this.details ? `\n${this.details}` : ""); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 02:57:43 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectSerializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-25 16:49:51 +08:00
										 |  |  | 	serialize({ write }) { | 
					
						
							|  |  |  | 		write(this.name); | 
					
						
							|  |  |  | 		write(this.message); | 
					
						
							|  |  |  | 		write(this.stack); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | 		write(this.details); | 
					
						
							|  |  |  | 		write(this.loc); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:49:51 +08:00
										 |  |  | 		write(this.hideStack); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-12 02:57:43 +08:00
										 |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {ObjectDeserializerContext} context context | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-10-25 16:49:51 +08:00
										 |  |  | 	deserialize({ read }) { | 
					
						
							|  |  |  | 		this.name = read(); | 
					
						
							|  |  |  | 		this.message = read(); | 
					
						
							|  |  |  | 		this.stack = read(); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | 		this.details = read(); | 
					
						
							|  |  |  | 		this.loc = read(); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:49:51 +08:00
										 |  |  | 		this.hideStack = read(); | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-25 16:47:52 +08:00
										 |  |  | makeSerializable(WebpackError, "webpack/lib/WebpackError"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-04 00:57:02 +08:00
										 |  |  | module.exports = WebpackError; |