toDRException function
把任意异常转成 DRException:已经是的原样返回,其他的记为本地的 fallback。
Implementation
DRException toDRException(Object error, [String fallback = LocalErrorCode.networkError]) {
if (error is DRException) return error;
return DRException(code: fallback, message: error.toString(), source: ErrorSource.local, cause: error);
}