Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(uglifyjs): better error msg reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
danbucholtz committed Apr 5, 2017
1 parent d9d000a commit 49c0afb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/uglifyjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as uglify from 'uglify-js';

import { Logger } from './logger/logger';
import { fillConfigDefaults, generateContext, getUserConfigFile } from './util/config';
import { BuildError } from './util/errors';
import { writeFileAsync } from './util/helpers';
import { BuildContext, TaskInfo } from './util/interfaces';
import { runWorker } from './worker-client';
Expand All @@ -20,8 +21,8 @@ export function uglifyjs(context: BuildContext, configFile?: string) {
.then(() => {
logger.finish();
})
.catch(err => {
throw logger.fail(err);
.catch((err: BuildError) => {
throw logger.fail(new BuildError(err));
});
}

Expand Down Expand Up @@ -53,6 +54,10 @@ export function uglifyjsWorkerImpl(context: BuildContext, uglifyJsConfig: Uglify
}

return Promise.all(promises);
}).catch((err: any) => {
// uglify has it's own strange error format
const errorString = `${err.message} in ${err.filename} at line ${err.line}, col ${err.col}, pos ${err.pos}`;
throw new BuildError(new Error(errorString));
});
}

Expand Down

0 comments on commit 49c0afb

Please sign in to comment.