( data: ExcoEventData, )
| 84 | * payload itself may carry the message or code. |
| 85 | */ |
| 86 | export const getExcoErrorMessage = ( |
| 87 | data: ExcoEventData, |
| 88 | ): string | undefined => { |
| 89 | const details = |
| 90 | getLogErrorDetails(data.error) ?? |
| 91 | getLogErrorDetails(data as Record<string, unknown>); |
| 92 | |
| 93 | if (!details) { |
| 94 | return undefined; |
| 95 | } |
| 96 | |
| 97 | const message = details.message ?? details.name; |
| 98 | |
| 99 | if (details.code && message) { |
| 100 | return `${details.code}: ${message}`; |
| 101 | } |
| 102 | |
| 103 | return message ?? details.code; |
| 104 | }; |
| 105 | |
| 106 | export type ExcoPlayerInstance = { |
| 107 | /** Every other call errors until the promise settles. */ |
no test coverage detected