2016-01-04 04:42:56 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2017-01-09 11:48:49 +08:00
|
|
|
"use strict";
|
|
|
|
|
2017-03-25 05:17:47 +08:00
|
|
|
const WebpackError = require("./WebpackError");
|
2017-03-22 20:00:57 +08:00
|
|
|
const cleanUp = require("./ErrorHelpers").cleanUp;
|
|
|
|
|
2017-03-25 05:17:47 +08:00
|
|
|
class ModuleWarning extends WebpackError {
|
2017-01-09 11:48:49 +08:00
|
|
|
constructor(module, warning) {
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.name = "ModuleWarning";
|
|
|
|
this.module = module;
|
2018-02-25 09:00:20 +08:00
|
|
|
this.message =
|
|
|
|
warning && typeof warning === "object" && warning.message
|
|
|
|
? warning.message
|
|
|
|
: warning;
|
2017-01-09 11:48:49 +08:00
|
|
|
this.warning = warning;
|
2018-02-25 09:00:20 +08:00
|
|
|
this.details =
|
|
|
|
warning && typeof warning === "object" && warning.stack
|
|
|
|
? cleanUp(warning.stack, this.message)
|
|
|
|
: undefined;
|
2017-02-16 03:55:54 +08:00
|
|
|
|
|
|
|
Error.captureStackTrace(this, this.constructor);
|
2017-01-09 11:48:49 +08:00
|
|
|
}
|
2016-01-04 04:42:56 +08:00
|
|
|
}
|
|
|
|
|
2017-01-09 11:48:49 +08:00
|
|
|
module.exports = ModuleWarning;
|