(_, { url, type })
| 178 | GraphQLContext, |
| 179 | QueryEmbedCodeArgs |
| 180 | > = async (_, { url, type }) => { |
| 181 | const embedResponse = (await getEmbedResponse({ |
| 182 | url, |
| 183 | type, |
| 184 | }).catch((__) => { |
| 185 | throw Error.notFound( |
| 186 | `Embed Code for URL ${url} not found${ |
| 187 | type?.trim() ? ` for type ${type}` : "" |
| 188 | }`, |
| 189 | ); |
| 190 | })) as OembedResponse & { error: boolean }; |
| 191 | |
| 192 | const { html, error, provider_name, height, width } = embedResponse; |
| 193 | |
| 194 | if (error) { |
| 195 | throw Error.notFound( |
| 196 | `Embed Code for URL ${url} not found${ |
| 197 | type?.trim() ? ` for type ${type}` : "" |
| 198 | }`, |
| 199 | ); |
| 200 | } |
| 201 | |
| 202 | return { |
| 203 | html: html ? sanitizeOembedHtml(html) : html, |
| 204 | providerName: provider_name, |
| 205 | height, |
| 206 | width, |
| 207 | }; |
| 208 | }; |
nothing calls this directly
no test coverage detected