@@ -4,7 +4,6 @@ import * as node_ssh from "node-ssh";
4
4
import os from "os" ;
5
5
import path , { parse as parsePath } from 'path' ;
6
6
import { EventEmitter } from 'stream' ;
7
- import { EditorPath } from './types' ;
8
7
import { CompileTools } from "./CompileTools" ;
9
8
import IBMiContent from "./IBMiContent" ;
10
9
import { Tools } from './Tools' ;
@@ -16,9 +15,9 @@ import * as configVars from './configVars';
16
15
import { DebugConfiguration } from "./configuration/DebugConfiguration" ;
17
16
import { ConnectionManager } from './configuration/config/ConnectionManager' ;
18
17
import { ConnectionConfig , RemoteConfigFile } from './configuration/config/types' ;
19
- import { CachedServerSettings , CodeForIStorage } from './configuration/storage/CodeForIStorage' ;
20
- import { AspInfo , CommandData , CommandResult , ConnectionData , IBMiMember , RemoteCommand , WrapResult } from './types' ;
21
18
import { ConfigFile } from './configuration/serverFile' ;
19
+ import { CachedServerSettings , CodeForIStorage } from './configuration/storage/CodeForIStorage' ;
20
+ import { AspInfo , CommandData , CommandResult , ConnectionData , EditorPath , IBMiMember , RemoteCommand , WrapResult } from './types' ;
22
21
23
22
export interface MemberParts extends IBMiMember {
24
23
basename : string
@@ -28,8 +27,9 @@ export type ConnectionMessageType = 'info' | 'warning' | 'error';
28
27
export type ConnectionErrorCode = `shell_config` | `home_directory_creation` | `QCPTOIMPF_exists` | `QCPFRMIMPF_exists` | `default_not_bash` | `invalid_bashrc` | `invalid_temp_lib` | `no_auto_conv_ebcdic` | `not_loaded_debug_config` | `no_sql_runner` | `ccsid_warning`;
29
28
30
29
export interface ConnectionResult {
31
- success : boolean ,
32
- errorCodes ?: ConnectionErrorCode [ ] ,
30
+ success : boolean
31
+ error ?: string
32
+ errorCodes ?: ConnectionErrorCode [ ]
33
33
}
34
34
35
35
const remoteApps = [ // All names MUST also be defined as key in 'remoteFeatures' below!!
@@ -122,7 +122,7 @@ export default class IBMi {
122
122
* the root of the IFS, thus why we store it.
123
123
*/
124
124
private iAspInfo : AspInfo [ ] = [ ] ;
125
- private currentAsp : string | undefined ;
125
+ private currentAsp : string | undefined ;
126
126
private libraryAsps = new Map < string , number > ( ) ;
127
127
128
128
/**
@@ -990,16 +990,22 @@ export default class IBMi {
990
990
991
991
let error = e . message ;
992
992
if ( e . code === "ENOTFOUND" ) {
993
- error = `Host is unreachable. Check the connection's hostname/IP address.` ;
993
+ error = `host is unreachable. Check the connection's hostname/IP address.` ;
994
994
}
995
995
else if ( e . code === "ECONNREFUSED" ) {
996
- error = `Port ${ connectionObject . port } is unreachable. Check the connection's port number or run command STRTCPSVR SERVER(*SSHD) on the host.`
996
+ error = `port ${ connectionObject . port } is unreachable. Check the connection's port number or run command STRTCPSVR SERVER(*SSHD) on the host.`
997
997
}
998
998
else if ( e . level === "client-authentication" ) {
999
- error = `Check your credentials${ e . message ? ` (${ e . message } )` : '' } .` ;
999
+ error = `check your credentials${ e . message ? ` (${ e . message } )` : '' } .` ;
1000
+ }
1001
+
1002
+ this . appendOutput ( `${ JSON . stringify ( e ) } ` ) ;
1003
+ if ( typeof e . stack === "string" ) {
1004
+ this . appendOutput ( `\n\n${ e . stack } ` ) ;
1000
1005
}
1001
1006
1002
1007
return {
1008
+ error,
1003
1009
success : false
1004
1010
} ;
1005
1011
}
@@ -1523,7 +1529,7 @@ export default class IBMi {
1523
1529
return this . remoteFeatures [ `startDebugService.sh` ] !== undefined ;
1524
1530
}
1525
1531
1526
- private async getUserProfileAsp ( ) : Promise < string | undefined > {
1532
+ private async getUserProfileAsp ( ) : Promise < string | undefined > {
1527
1533
const [ currentRdb ] = await this . runSQL ( `values current_server` ) ;
1528
1534
1529
1535
if ( currentRdb ) {
@@ -1541,8 +1547,8 @@ export default class IBMi {
1541
1547
return this . iAspInfo ;
1542
1548
}
1543
1549
1544
- getIAspDetail ( by : string | number ) {
1545
- let asp : AspInfo | undefined ;
1550
+ getIAspDetail ( by : string | number ) {
1551
+ let asp : AspInfo | undefined ;
1546
1552
if ( typeof by === 'string' ) {
1547
1553
asp = this . iAspInfo . find ( asp => asp . name === by ) ;
1548
1554
} else {
@@ -1554,14 +1560,14 @@ export default class IBMi {
1554
1560
}
1555
1561
}
1556
1562
1557
- getIAspName ( by : string | number ) : string | undefined {
1563
+ getIAspName ( by : string | number ) : string | undefined {
1558
1564
return this . getIAspDetail ( by ) ?. name ;
1559
1565
}
1560
1566
1561
1567
getCurrentIAspName ( ) {
1562
1568
return this . currentAsp ;
1563
1569
}
1564
- async lookupLibraryIAsp ( library : string ) : Promise < string | undefined > {
1570
+ async lookupLibraryIAsp ( library : string ) : Promise < string | undefined > {
1565
1571
library = this . upperCaseName ( library ) ;
1566
1572
let foundNumber = this . libraryAsps . get ( library ) ;
1567
1573
0 commit comments