| 440 | * @returns {object} - The root cause of `error`. |
| 441 | */ |
| 442 | export const getBackendErrorRootCause = error => { |
| 443 | let rootCause |
| 444 | if (hasCauses(error)) { |
| 445 | rootCause = error.cause |
| 446 | } else { |
| 447 | rootCause = getBackendErrorDetails(error) |
| 448 | } |
| 449 | |
| 450 | while ('cause' in rootCause) { |
| 451 | rootCause = rootCause.cause |
| 452 | } |
| 453 | |
| 454 | return rootCause |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * Returns the attributes of the backend error message, if any. |
no test coverage detected