Skip to content

Commit

Permalink
Media/YouTube: if API returns nada, report URL to Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
abettermap committed Oct 19, 2020
1 parent e48cc9a commit 5259294
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/media/MediaModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { FC } from 'react'
import * as Sentry from '@sentry/react'
import { useQuery, QueryCache, ReactQueryCacheProvider } from 'react-query'
import { Container, Button, Typography } from '@material-ui/core'
import { SimpleDialog } from 'components'
Expand Down Expand Up @@ -37,8 +38,14 @@ const MediaModalContent: FC<ModalContentProps> = (props) => {
)
}

// TODO: support HTML descriptions
const { title, description } = data.items[0].snippet
// TODO: support HTML descriptions from archive.org
const { title, description } = data.items[0]?.snippet || {}

if (!data.items.length) {
Sentry.captureException(
`The YouTube API did not return any itmes for the following URL: ${url}`
)
}

return (
<>
Expand Down

0 comments on commit 5259294

Please sign in to comment.