mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-03 22:41:08 +00:00
27 lines
602 B
Dart
27 lines
602 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'error.freezed.dart';
|
|
part 'error.g.dart';
|
|
|
|
@freezed
|
|
class AIError with _$AIError {
|
|
const factory AIError({
|
|
required String message,
|
|
@Default(AIErrorCode.other) AIErrorCode code,
|
|
}) = _AIError;
|
|
|
|
factory AIError.fromJson(Map<String, Object?> json) =>
|
|
_$AIErrorFromJson(json);
|
|
}
|
|
|
|
enum AIErrorCode {
|
|
@JsonValue('AIResponseLimitExceeded')
|
|
aiResponseLimitExceeded,
|
|
@JsonValue('Other')
|
|
other,
|
|
}
|
|
|
|
extension AIErrorExtension on AIError {
|
|
bool get isLimitExceeded => code == AIErrorCode.aiResponseLimitExceeded;
|
|
}
|