stack_wallet/lib/services/buy/buy_response.dart

40 lines
738 B
Dart
Raw Normal View History

/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
enum BuyExceptionType {
generic,
serializeResponseError,
cryptoAmountOutOfRange,
}
2023-01-11 15:54:39 +00:00
2023-01-11 23:02:57 +00:00
class BuyException implements Exception {
2023-01-11 15:54:39 +00:00
String errorMessage;
2023-01-11 23:02:57 +00:00
BuyExceptionType type;
BuyException(this.errorMessage, this.type);
2023-01-11 15:54:39 +00:00
@override
String toString() {
return errorMessage;
}
}
2023-01-11 23:02:57 +00:00
class BuyResponse<T> {
2023-01-14 14:21:32 +00:00
final T? value;
final BuyException? exception;
2023-01-11 15:54:39 +00:00
2023-01-11 23:02:57 +00:00
BuyResponse({this.value, this.exception});
2023-01-11 15:54:39 +00:00
@override
String toString() {
return "{error: $exception, value: $value}";
}
}