Skip to content

Commit 470958d

Browse files
committed
Use top level await to better log errors
1 parent 038968a commit 470958d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

bin/gtfs-ride.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import yargs from 'yargs';
55
import { hideBin } from 'yargs/helpers';
66

77
import { getConfig } from '../lib/file-utils.js';
8-
import { formatError } from '../lib/log-utils.js';
98
import gtfsRide from '../index.js';
109

1110
const { argv } = yargs(hideBin(process.argv))
@@ -43,17 +42,6 @@ const { argv } = yargs(hideBin(process.argv))
4342
})
4443
.default('skipAPCImport', undefined);
4544

46-
const handleError = (error) => {
47-
const text = error || 'Unknown Error';
48-
process.stdout.write(`\n${formatError(text)}\n`);
49-
console.error(error);
50-
process.exit(1);
51-
};
52-
53-
const setupImport = async () => {
54-
const config = await getConfig(argv);
55-
await gtfsRide(config);
56-
process.exit();
57-
};
58-
59-
setupImport().catch(handleError);
45+
const config = await getConfig(argv);
46+
await gtfsRide(config);
47+
process.exit();

0 commit comments

Comments
 (0)