Skip to content

Commit 670b0c9

Browse files
authored
Add error messaging to Filter Streams failures (#3222)
* revert changes * added messaging * detekt changes
1 parent d58688b commit 670b0c9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix to display appropriate error messaging for filtering Cloudwatch Streams using search patterns failures"
4+
}

jetbrains-core/src/software/aws/toolkits/jetbrains/services/cloudwatch/logs/CloudWatchActor.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
package software.aws.toolkits.jetbrains.services.cloudwatch.logs
55

66
import com.intellij.openapi.Disposable
7+
import com.intellij.openapi.application.runInEdt
78
import com.intellij.openapi.project.Project
9+
import com.intellij.openapi.ui.Messages
810
import com.intellij.ui.TableUtil
911
import com.intellij.ui.table.TableView
1012
import com.intellij.util.ExceptionUtil
@@ -255,12 +257,17 @@ class LogStreamFilterActor(
255257
return getSearchLogEvents(request)
256258
}
257259

258-
private fun getSearchLogEvents(request: FilterLogEventsRequest): List<LogStreamEntry> {
260+
private fun getSearchLogEvents(request: FilterLogEventsRequest): List<LogStreamEntry> = try {
259261
val response = client.filterLogEvents(request)
260262
val events = response.events().filterNotNull().map { it.toLogStreamEntry() }
261263
nextForwardToken = response.nextToken()
262264

263-
return events
265+
events
266+
} catch (e: Exception) {
267+
runInEdt {
268+
Messages.showErrorDialog(project, e.localizedMessage, message("cloudwatch.logs.failed_to_load_stream", logStream))
269+
}
270+
listOf()
264271
}
265272
}
266273

0 commit comments

Comments
 (0)