@@ -35,8 +35,8 @@ async function build() {
3535 const url = `https://github.com/mug1wara26/source-lsp/releases/latest/download/${ lspFilename } ` ;
3636 const outputPath = path . join ( outputFolder , lspFilename ) ; // Save in the same directory
3737 // Function below handles the 302 Found redirection from GitHub
38- await downloadFile ( url , outputPath ) ;
39- console . log ( `LSP server downloaded from ${ url } ` ) ;
38+ // await downloadFile(url, outputPath);
39+ // console.log(`LSP server downloaded from ${url}`);
4040}
4141
4242/**
@@ -52,25 +52,31 @@ function downloadFile(url, outputPath) {
5252 } ) ;
5353 }
5454 function onError ( err ) {
55+ console . log ( `Error: ${ err . message } ` ) ;
5556 fs . unlink ( outputPath , ( ) => {
5657 reject ( err ) ;
5758 } ) ;
5859 }
5960
6061 https
6162 . get ( url , ( res ) => {
63+ console . log ( `Response status code: ${ res . statusCode } ` ) ;
6264 if ( res . statusCode >= 200 && res . statusCode < 300 ) {
6365 if ( res . statusCode !== 200 ) {
6466 console . log ( "Warn: Status code is not 200" ) ;
6567 }
6668 onSuccess ( res ) ;
67- }
68- if ( res . statusCode === 301 || res . statusCode === 302 ) {
69+ } else if ( res . statusCode === 301 || res . statusCode === 302 ) {
70+ console . log ( `Redirecting to ${ res . headers . location } ` ) ;
6971 https
7072 . get ( res . headers . location , ( res ) => {
73+ // TODO: There needs to be second check here
74+ console . log ( `Response status code: ${ res . statusCode } ` ) ;
7175 onSuccess ( res ) ;
7276 } )
7377 . on ( "error" , onError ) ;
78+ } else {
79+ console . log ( `Error: ${ res . statusCode } ` ) ;
7480 }
7581 } )
7682 . on ( "error" , onError ) ;
0 commit comments