forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleInfoPlugin.ts
More file actions
22 lines (18 loc) · 793 Bytes
/
ModuleInfoPlugin.ts
File metadata and controls
22 lines (18 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { IModule } from '../../models/IModule';
import { EventPluginContext } from '../EventPluginContext';
import { IEventPlugin } from '../IEventPlugin';
export class ModuleInfoPlugin implements IEventPlugin {
public priority: number = 50;
public name: string = 'ModuleInfoPlugin';
public run(context: EventPluginContext, next?: () => void): void {
const ERROR_KEY: string = '@error'; // optimization for minifier.
const collector = context.client.config.moduleCollector;
if (context.event.data[ERROR_KEY] && !context.event.data['@error'].modules && !!collector) {
const modules: IModule[] = collector.getModules(context);
if (modules && modules.length > 0) {
context.event.data[ERROR_KEY].modules = modules;
}
}
next && next();
}
}