mirror of https://github.com/webpack/webpack.git
				
				
				
			Add HideStackError class for errors that have hideStack = true
This commit is contained in:
		
							parent
							
								
									0e404b8683
								
							
						
					
					
						commit
						4ae95a6892
					
				|  | @ -0,0 +1,11 @@ | |||
| /* | ||||
| 	MIT License http://www.opensource.org/licenses/mit-license.php
 | ||||
| */ | ||||
| "use strict"; | ||||
| 
 | ||||
| module.exports = class HiddenStackError extends Error { | ||||
| 	constructor(...args) { | ||||
| 		super(...args); | ||||
| 		this.hideStack = true; | ||||
| 	} | ||||
| }; | ||||
|  | @ -5,6 +5,7 @@ | |||
| "use strict"; | ||||
| const HarmonyImportDependency = require("./HarmonyImportDependency"); | ||||
| const Template = require("../Template"); | ||||
| const HiddenStackError = require("../HiddenStackError"); | ||||
| 
 | ||||
| class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { | ||||
| 	constructor( | ||||
|  | @ -340,10 +341,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { | |||
| 				const exportName = this.id | ||||
| 					? `the named export '${this.id}'` | ||||
| 					: "the namespace object"; | ||||
| 				const err = new Error( | ||||
| 				const err = new HiddenStackError( | ||||
| 					`Can't reexport ${exportName} from non EcmaScript module (only default export is available)` | ||||
| 				); | ||||
| 				err.hideStack = true; | ||||
| 				return [err]; | ||||
| 			} | ||||
| 			return; | ||||
|  | @ -364,8 +364,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { | |||
| 		const errorMessage = `"export '${ | ||||
| 			this.id | ||||
| 		}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
 | ||||
| 		const err = new Error(errorMessage); | ||||
| 		err.hideStack = true; | ||||
| 		const err = new HiddenStackError(errorMessage); | ||||
| 		return [err]; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
| */ | ||||
| "use strict"; | ||||
| const HarmonyImportDependency = require("./HarmonyImportDependency"); | ||||
| const HiddenStackError = require("../HiddenStackError"); | ||||
| 
 | ||||
| class HarmonyImportSpecifierDependency extends HarmonyImportDependency { | ||||
| 	constructor( | ||||
|  | @ -76,10 +77,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { | |||
| 				const exportName = this.id | ||||
| 					? `the named export '${this.id}'` | ||||
| 					: "the namespace object"; | ||||
| 				const err = new Error( | ||||
| 				const err = new HiddenStackError( | ||||
| 					`Can't import ${exportName} from non EcmaScript module (only default export is available)` | ||||
| 				); | ||||
| 				err.hideStack = true; | ||||
| 				return [err]; | ||||
| 			} | ||||
| 			return; | ||||
|  | @ -100,8 +100,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { | |||
| 		const errorMessage = `"export '${ | ||||
| 			this.id | ||||
| 		}'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
 | ||||
| 		const err = new Error(errorMessage); | ||||
| 		err.hideStack = true; | ||||
| 		const err = new HiddenStackError(errorMessage); | ||||
| 		return [err]; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue