Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parse unknown error #1729

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class LocalizedErrorMessage with _$LocalizedErrorMessage {
@JsonSerializable(explicitToJson: true)
const factory LocalizedErrorMessage({
/// The error code for example Cancelled
@JsonKey(unknownEnumValue: FailureCode.Unknown)
required FailureCode code,

/// Localized error message if any
Expand All @@ -73,7 +74,7 @@ class LocalizedErrorMessage with _$LocalizedErrorMessage {
_$LocalizedErrorMessageFromJson(json);
}

enum FailureCode { Failed, Canceled, Timeout }
enum FailureCode { Failed, Canceled, Timeout, Unknown }

class StripeConfigException implements Exception {
const StripeConfigException(this.message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ LocalizedErrorMessage _$LocalizedErrorMessageFromJson(
/// @nodoc
mixin _$LocalizedErrorMessage {
/// The error code for example Cancelled
@JsonKey(unknownEnumValue: FailureCode.Unknown)
FailureCode get code => throw _privateConstructorUsedError;

/// Localized error message if any
Expand Down Expand Up @@ -376,7 +377,7 @@ abstract class $LocalizedErrorMessageCopyWith<$Res> {
_$LocalizedErrorMessageCopyWithImpl<$Res, LocalizedErrorMessage>;
@useResult
$Res call(
{FailureCode code,
{@JsonKey(unknownEnumValue: FailureCode.Unknown) FailureCode code,
String? localizedMessage,
String? message,
String? stripeErrorCode,
Expand Down Expand Up @@ -444,7 +445,7 @@ abstract class _$$LocalizedErrorMessageImplCopyWith<$Res>
@override
@useResult
$Res call(
{FailureCode code,
{@JsonKey(unknownEnumValue: FailureCode.Unknown) FailureCode code,
String? localizedMessage,
String? message,
String? stripeErrorCode,
Expand Down Expand Up @@ -505,7 +506,7 @@ class __$$LocalizedErrorMessageImplCopyWithImpl<$Res>
@JsonSerializable(explicitToJson: true)
class _$LocalizedErrorMessageImpl implements _LocalizedErrorMessage {
const _$LocalizedErrorMessageImpl(
{required this.code,
{@JsonKey(unknownEnumValue: FailureCode.Unknown) required this.code,
this.localizedMessage,
this.message,
this.stripeErrorCode,
Expand All @@ -517,6 +518,7 @@ class _$LocalizedErrorMessageImpl implements _LocalizedErrorMessage {

/// The error code for example Cancelled
@override
@JsonKey(unknownEnumValue: FailureCode.Unknown)
final FailureCode code;

/// Localized error message if any
Expand Down Expand Up @@ -582,7 +584,8 @@ class _$LocalizedErrorMessageImpl implements _LocalizedErrorMessage {

abstract class _LocalizedErrorMessage implements LocalizedErrorMessage {
const factory _LocalizedErrorMessage(
{required final FailureCode code,
{@JsonKey(unknownEnumValue: FailureCode.Unknown)
required final FailureCode code,
final String? localizedMessage,
final String? message,
final String? stripeErrorCode,
Expand All @@ -595,6 +598,7 @@ abstract class _LocalizedErrorMessage implements LocalizedErrorMessage {
@override

/// The error code for example Cancelled
@JsonKey(unknownEnumValue: FailureCode.Unknown)
FailureCode get code;
@override

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.