Skip to content

Commit

Permalink
fix: ensure errors are reported consistently in container cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanstanev committed Oct 16, 2020
1 parent fd827fd commit ef3ce4b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/ecosystems/monitor.ts
Expand Up @@ -11,7 +11,7 @@ import { getPlugin } from './plugins';
import { BadResult, GoodResult } from '../../cli/commands/monitor/types';
import { formatMonitorOutput } from '../../cli/commands/monitor/formatters/format-monitor-response';
import { getExtraProjectCount } from '../plugins/get-extra-project-count';
import { MonitorError } from '../errors';
import { AuthFailedError, MonitorError } from '../errors';
import {
Ecosystem,
ScanResult,
Expand Down Expand Up @@ -105,8 +105,11 @@ async function monitorDependencies(
scanResult,
});
} catch (error) {
if (error.code === 401) {
throw AuthFailedError();
}
if (error.code >= 400 && error.code < 500) {
throw new Error(error.message);
throw new MonitorError(error.code, error.message);
}
errors.push({
error: 'Could not monitor dependencies in ' + path,
Expand Down

0 comments on commit ef3ce4b

Please sign in to comment.