-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added contract cache added efficiency improvements, preventing multiple similar calls.
- Loading branch information
Showing
2 changed files
with
125 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
lib/core/error_handler/extensions/blockchain_error_extension.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:dio/dio.dart'; | ||
import 'package:hypha_wallet/core/logging/log_helper.dart'; | ||
|
||
extension BlockChainErrorExtension on Object { | ||
String extendedBlockchainErrorMessage() { | ||
final DioException? thisException = (this is DioException ? this : null) as DioException?; | ||
if (thisException != null && thisException.response != null) { | ||
try { | ||
final data = thisException.response!.data; | ||
final code = data['code']; | ||
final errorData = data['error'] as Map; | ||
final what = errorData['what']; | ||
final details = errorData['details'] as List; | ||
final detailedMessage = details[0]; | ||
|
||
return 'Error Code: $code' | ||
'\nWhat: $what' | ||
'\nMessage: $detailedMessage'; | ||
} catch (e) { | ||
LogHelper.e('error during parsing of block chain error $e'); | ||
return 'Raw error: ${thisException.response!.data}'; | ||
} | ||
} | ||
|
||
return toString(); | ||
} | ||
} | ||
// flutter: Response Data: {code: 401, message: UnAuthorized, error: {code: 3090003, name: unsatisfied_authorization, what: Provided keys, permissions, and delays do not satisfy declared authorizations, details: [{message: transaction declares authority '{"actor":"illumination","permission":"owner"}', but does not have signatures for it., file: authorization_manager.cpp, line_number: 626, method: get_required_keys}]}} |