File tree Expand file tree Collapse file tree
apollo-language-server/src/errors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 ExecutionContext
2929} from "graphql/execution/execute" ;
3030import { hasClientDirective , simpleCollectFields } from "../utilities/graphql" ;
31+ import { Debug } from "../utilities" ;
3132
3233export interface CodeActionInfo {
3334 message : string ;
@@ -72,7 +73,7 @@ export function validateQueryDocument(
7273 for ( const error of validationErrors ) {
7374 logError ( error ) ;
7475 }
75- throw new ToolError ( "Validation of GraphQL query document failed" ) ;
76+ return Debug . error ( "Validation of GraphQL query document failed" ) ;
7677 }
7778 } catch ( e ) {
7879 console . error ( e ) ;
Original file line number Diff line number Diff line change @@ -108,10 +108,7 @@ export abstract class ProjectCommand extends Command {
108108 Debug . SetLoggers ( {
109109 info : this . log ,
110110 warning : this . warn ,
111- error : message => {
112- this . error ( message ) ;
113- this . exit ( 1 ) ;
114- }
111+ error : console . error
115112 } ) ;
116113
117114 const config = await this . createConfig ( flags ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ import { Kind, DocumentNode } from "graphql";
55import tty from "tty" ;
66import { Gaze } from "gaze" ;
77import URI from "vscode-uri" ;
8+ import chalk from "chalk" ;
9+ import { Debug } from "apollo-language-server" ;
810
911import { TargetType , default as generate } from "../../generate" ;
10-
1112import { ClientCommand } from "../../Command" ;
1213
1314const waitForKey = async ( ) => {
@@ -246,7 +247,12 @@ export default class Generate extends ClientCommand {
246247 if ( file . indexOf ( output ) > - 1 ) return ;
247248 this . project . fileDidChange ( URI . file ( file ) . toString ( ) ) ;
248249 console . log ( "\nChange detected, generating types..." ) ;
249- write ( ) ;
250+ try {
251+ const fileCount = write ( ) ;
252+ console . log ( `${ chalk . green ( "✔" ) } Wrote ${ fileCount } files` ) ;
253+ } catch ( e ) {
254+ Debug . error ( "Error while generating types: " + e . message ) ;
255+ }
250256 } ) ;
251257 if ( tty . isatty ( ( process . stdin as any ) . fd ) ) {
252258 await waitForKey ( ) ;
You can’t perform that action at this time.
0 commit comments