Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.4.7] - 2026-04-27

* Added `isMaintenanceError` and `shouldSuppressLogging` getters to `RemoteError`
and `ErrorResult` extensions. `shouldSuppressLogging` indicates that the error
should not be logged or shown to the user via a separate message (e.g. during
server maintenance).

## [0.4.6] - 2026-04-02

* Added `maintenanceError` and `serviceDownError` error codes to `GlobalErrorCode`.
Expand Down
12 changes: 12 additions & 0 deletions lib/src/error_result_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ extension CommonErrorResultExtensionErrorCode on ErrorResult? {
bool isValidationError([int? code]) =>
toError()?.isValidationError(code) ?? false;

/// Определяет, является ли ошибка сообщением о режиме обслуживания.
///
/// См. [GlobalErrorCode.maintenanceError].
bool get isMaintenanceError =>
Comment thread
greymag marked this conversation as resolved.
Outdated
toError()?.isMaintenanceError ?? false;

/// Определяет, следует ли подавить логирование данной ошибки.
///
/// См. [CommonRemoteErrorExtensionErrorCode.shouldSuppressLogging].
bool get shouldSuppressLogging =>
toError()?.shouldSuppressLogging ?? false;
Comment thread
greymag marked this conversation as resolved.
Outdated

/// Возвращает [RemoteError] текущего результата.
RemoteError? toError() =>
this?.error is RemoteError ? this!.error as RemoteError : null;
Expand Down
14 changes: 14 additions & 0 deletions lib/src/remote_error_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ extension CommonRemoteErrorExtensionErrorCode on RemoteError {
/// Определяет, соответствует ли ошибка указанному коду [ValidationErrorCode] если указан.
bool isValidationError([int? code]) =>
isError(ValidationErrorCode.domain, code);

/// Определяет, является ли ошибка сообщением о режиме обслуживания.
///
/// См. [GlobalErrorCode.maintenanceError].
bool get isMaintenanceError => isGlobalError(GlobalErrorCode.maintenanceError);
Comment thread
greymag marked this conversation as resolved.
Outdated

/// Определяет, следует ли подавить логирование данной ошибки.
///
/// Возвращает `true` для ошибок, которые являются временным/ожидаемым
/// состоянием сервера (например, режим обслуживания) - такие ошибки
/// не должны попадать в логи и не должны инициировать показ отдельных
/// сообщений пользователю (за исключением случаев, когда пользователю
/// требуется показать результат запроса явно).
Comment thread
greymag marked this conversation as resolved.
Outdated
bool get shouldSuppressLogging => isMaintenanceError;
Comment thread
greymag marked this conversation as resolved.
Outdated
}

/// Расширения [RemoteError] для работы с кодами общих ошибок.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: innim_remote_error
description: Remote error object and common codes for Innim projects. Using Dio.
version: 0.4.6
version: 0.4.7
homepage: https://github.com/innim/
repository: https://github.com/Innim/flutter_remote_error
issue_tracker: https://github.com/Innim/flutter_remote_error/issues
Expand Down
Loading