Skip to content

Commit 1d79eaa

Browse files
committed
use chalk for better error messaging
1 parent b61aee1 commit 1d79eaa

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/apollo/src/commands/service/download.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { flags } from "@oclif/command";
22
import { introspectionFromSchema } from "graphql";
33
import { writeFileSync } from "fs";
4+
import chalk from "chalk";
45
import { ProjectCommand } from "../../Command";
56

67
export default class ServiceDownload extends ProjectCommand {
@@ -45,9 +46,16 @@ export default class ServiceDownload extends ProjectCommand {
4546
);
4647
} catch (e) {
4748
if (e.code == "ECONNREFUSED") {
48-
console.error(
49-
`❌ ERROR: Connection refused. You may not be running a service locally, or your endpoint url is incorrect.\n` +
49+
this.log(chalk.red("ERROR: Connection refused."));
50+
this.log(
51+
chalk.red(
52+
"You may not be running a service locally, or your endpoint url is incorrect."
53+
)
54+
);
55+
this.log(
56+
chalk.red(
5057
"If you're trying to download a schema from Apollo Engine, use the `client:download-schema` command instead."
58+
)
5159
);
5260
}
5361
throw e;

0 commit comments

Comments
 (0)