Skip to content

Commit

Permalink
external-widgets: Catch uncaught case where Cockpit cannot fetch info…
Browse files Browse the repository at this point in the history
… from BlueOS
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Jan 16, 2025
1 parent 04ab401 commit 7ae62e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/EditMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ import URLVideoPlayerImg from '@/assets/widgets/URLVideoPlayer.png'
import VideoPlayerImg from '@/assets/widgets/VideoPlayer.png'
import VirtualHorizonImg from '@/assets/widgets/VirtualHorizon.png'
import { useInteractionDialog } from '@/composables/interactionDialog'
import { openSnackbar } from '@/composables/snackbar'
import { getWidgetsFromBlueOS } from '@/libs/blueos'
import { MavType } from '@/libs/connection/m2r/messages/mavlink2rest-enum'
import { isHorizontalScroll } from '@/libs/utils'
Expand Down Expand Up @@ -992,7 +993,12 @@ const miniWidgetsContainerOptions = ref<UseDraggableOptions>({
useDraggable(availableMiniWidgetsContainer, availableMiniWidgetTypes, miniWidgetsContainerOptions)
const getExternalWidgetSetupInfos = async (): Promise<void> => {
ExternalWidgetSetupInfos.value = await getWidgetsFromBlueOS()
try {
ExternalWidgetSetupInfos.value = await getWidgetsFromBlueOS()
} catch (error) {
const errorMessage = 'Error getting info around external widgets from BlueOS.'
openSnackbar({ message: errorMessage, variant: 'error', closeButton: true })
}
}
// @ts-ignore: Documentation is not clear on what generic should be passed to 'UseDraggableOptions'
Expand Down

0 comments on commit 7ae62e6

Please sign in to comment.