* Helper function to handle errors when fetching timeline configuration. * Creates a minimal TimelineConfig with the appropriate error logged. * * @param {Error} error - The error that occurred * @param {function} callback - Callback to invoke with the error TimelineConfig
(error, callback)
| 313 | * @param {function} callback - Callback to invoke with the error TimelineConfig |
| 314 | */ |
| 315 | function handleConfigError(error, callback) { |
| 316 | const tc = new TimelineConfig(); |
| 317 | if (error.name == 'NetworkError') { |
| 318 | tc.logError(new TLError("network_err")); |
| 319 | } else if (error.name == 'TLError') { |
| 320 | tc.logError(error); |
| 321 | } else { |
| 322 | tc.logError(new TLError("unknown_read_err", error.name || error)); |
| 323 | } |
| 324 | callback(tc); |
| 325 | } |
| 326 | |
| 327 | /** |
| 328 | * Helper function to create a TimelineConfig from JSON data. |