@@ -18,17 +18,12 @@ import { ConfigBuilder } from './ConfigBuilder';
18
18
import type { Config } from './Config' ;
19
19
import type { Extension } from '../interfaces/Extension' ;
20
20
import { Observable } from '../lib/Observable' ;
21
+ import type { SessionTerminationInfo } from '../interfaces/SessionTerminationInfo' ;
21
22
22
23
type OnRemoteClipboardChanged = ( data : ClipboardData ) => void ;
23
24
type OnRemoteReceivedFormatsList = ( ) => void ;
24
25
type OnForceClipboardUpdate = ( ) => void ;
25
26
26
- const isIronError = ( error : unknown ) : error is IronError =>
27
- typeof error === 'object' &&
28
- error !== null &&
29
- typeof ( error as IronError ) . backtrace === 'function' &&
30
- typeof ( error as IronError ) . kind === 'function' ;
31
-
32
27
export class RemoteDesktopService {
33
28
private module : RemoteDesktopModule ;
34
29
private canvas ?: HTMLCanvasElement ;
@@ -158,7 +153,7 @@ export class RemoteDesktopService {
158
153
throw new Error ( 'could not connect to the session' ) ;
159
154
} ) ;
160
155
161
- await this . run ( session ) ;
156
+ this . run ( session ) ;
162
157
163
158
loggingService . info ( 'Session started.' ) ;
164
159
@@ -180,19 +175,17 @@ export class RemoteDesktopService {
180
175
} ;
181
176
}
182
177
183
- async run ( session : Session ) : Promise < Session > {
184
- try {
185
- const termination_info = await session . run ( ) ;
186
-
187
- this . setVisibility ( false ) ;
188
- this . raiseSessionEvent ( {
189
- type : SessionEventType . TERMINATED ,
190
- data : 'Session was terminated: ' + termination_info . reason ( ) + '.' ,
191
- } ) ;
192
-
193
- return session ;
194
- } catch ( err ) {
195
- if ( isIronError ( err ) ) {
178
+ run ( session : Session ) {
179
+ session
180
+ . run ( )
181
+ . then ( ( terminationInfo : SessionTerminationInfo ) => {
182
+ this . setVisibility ( false ) ;
183
+ this . raiseSessionEvent ( {
184
+ type : SessionEventType . TERMINATED ,
185
+ data : 'Session was terminated: ' + terminationInfo . reason ( ) + '.' ,
186
+ } ) ;
187
+ } )
188
+ . catch ( ( err : IronError ) => {
196
189
this . setVisibility ( false ) ;
197
190
198
191
this . raiseSessionEvent ( {
@@ -203,10 +196,7 @@ export class RemoteDesktopService {
203
196
type : SessionEventType . TERMINATED ,
204
197
data : 'Session was terminated.' ,
205
198
} ) ;
206
- }
207
-
208
- throw new Error ( 'could not run the session.' ) ;
209
- }
199
+ } ) ;
210
200
}
211
201
212
202
sendSpecialCombination ( specialCombination : SpecialCombination ) : void {
0 commit comments