7
7
import software .aws .toolkits .eclipse .amazonq .chat .models .ChatRequestParams ;
8
8
import software .aws .toolkits .eclipse .amazonq .chat .models .ChatResult ;
9
9
import software .aws .toolkits .eclipse .amazonq .chat .models .GenericTabParams ;
10
+ import software .aws .toolkits .eclipse .amazonq .exception .AmazonQPluginException ;
10
11
import software .aws .toolkits .eclipse .amazonq .lsp .AmazonQLspServer ;
11
12
import software .aws .toolkits .eclipse .amazonq .providers .LspProvider ;
12
13
import software .aws .toolkits .eclipse .amazonq .util .PluginLogger ;
@@ -20,7 +21,8 @@ public ChatMessageProvider() {
20
21
try {
21
22
amazonQLspServer = LspProvider .getAmazonQServer ().get ();
22
23
} catch (InterruptedException | ExecutionException e ) {
23
- PluginLogger .error ("Error occurred while retrieving Amazon Q LSP server. Failed to instantiate ChatMessageProvider." );
24
+ PluginLogger .error ("Error occurred while retrieving Amazon Q LSP server. Failed to instantiate ChatMessageProvider." , e );
25
+ throw new AmazonQPluginException (e );
24
26
}
25
27
}
26
28
@@ -31,23 +33,27 @@ public ChatResult sendChatPrompt(final ChatRequestParams chatRequestParams) {
31
33
return chatResult ;
32
34
} catch (InterruptedException | ExecutionException e ) {
33
35
PluginLogger .error ("Error occurred while sending " + Command .CHAT_SEND_PROMPT + " message to Amazon Q LSP server" , e );
34
- e . printStackTrace ( );
36
+ throw new AmazonQPluginException ( e );
35
37
}
36
- return null ;
37
38
}
38
39
39
40
public void sendChatReady () {
40
- PluginLogger . info ( "Sending " + Command . CHAT_READY + " message to Amazon Q LSP server" );
41
- amazonQLspServer . chatReady ( );
42
- }
43
-
44
- public void sendChatReady () {
45
- PluginLogger . info ( "Sending " + Command . CHAT_READY + " message to Amazon Q LSP server" );
46
- amazonQLspServer . chatReady ();
41
+ try {
42
+ PluginLogger . info ( "Sending " + Command . CHAT_READY + " message to Amazon Q LSP server" );
43
+ amazonQLspServer . chatReady ();
44
+ } catch ( Exception e ) {
45
+ PluginLogger . error ( "Error occurred while sending " + Command . CHAT_READY + " message to Amazon Q LSP server" , e );
46
+ throw new AmazonQPluginException ( e );
47
+ }
47
48
}
48
49
49
50
public void sendTabAdd (final GenericTabParams tabParams ) {
50
- PluginLogger .info ("Sending " + Command .CHAT_TAB_ADD + " message to Amazon Q LSP server" );
51
- amazonQLspServer .tabAdd (tabParams );
51
+ try {
52
+ PluginLogger .info ("Sending " + Command .CHAT_TAB_ADD + " message to Amazon Q LSP server" );
53
+ amazonQLspServer .tabAdd (tabParams );
54
+ } catch (Exception e ) {
55
+ PluginLogger .error ("Error occurred while sending " + Command .CHAT_TAB_ADD + " message to Amazon Q LSP server" , e );
56
+ throw new AmazonQPluginException (e );
57
+ }
52
58
}
53
59
}
0 commit comments