isTransientError function

bool isTransientError(
  1. DRException err
)

错误码属于“暂时故障”(《sdk-web/2.功能概述文档》第 17 节的分类)。

Implementation

bool isTransientError(DRException err) {
  if (err.code == LocalErrorCode.networkError || err.code == LocalErrorCode.timeout || err.code == 'internal') return true;
  final status = err.status;
  return err.source == ErrorSource.http &&
      status != null &&
      status >= 500 &&
      err.code != 'tenant_unavailable' &&
      err.code != 'app_unavailable';
}