(context, callable, fallback)
| 57 | // ) |
| 58 | // |
| 59 | export async function executeWithFallback(context, callable, fallback) { |
| 60 | try { |
| 61 | return await callable(context) |
| 62 | } catch (error) { |
| 63 | if (isLiquidError(error) && context.currentLanguage !== 'en') { |
| 64 | const enContext = Object.assign({}, context, { currentLanguage: 'en' }) |
| 65 | return await fallback(enContext) |
| 66 | } |
| 67 | throw error |
| 68 | } |
| 69 | } |
no test coverage detected