stack_wallet/lib/services/buy/buy_response.dart

39 lines
737 B
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* 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}";
}
}