-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: create custom error screen #297
base: main
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ class AccountsStore { | |
final Observable<bool> _isBalancesLoadingError = Observable(false); | ||
final Observable<bool> _isRenamingAccount = Observable(false); | ||
final Observable<bool> _isSendingMoney = Observable(false); | ||
final Observable<String> _errorDetails = Observable(''); | ||
|
||
final ObservableList<Balance> balancesList = ObservableList(); | ||
final Observable<CredentialsStorageFailure?> loadAccountsFailure = Observable(null); | ||
|
@@ -78,6 +79,10 @@ class AccountsStore { | |
|
||
set isMnemonicCreatingError(bool val) => Action(() => _isMnemonicCreatingError.value = val)(); | ||
|
||
String get errorDetails => _errorDetails.value; | ||
|
||
set errorDetails(String val) => Action(() => _errorDetails.value = val)(); | ||
|
||
bool get isMnemonicCreating => _isMnemonicCreating.value; | ||
|
||
set isMnemonicCreating(bool val) => Action(() => _isMnemonicCreating.value = val)(); | ||
|
@@ -202,6 +207,7 @@ class AccountsStore { | |
return result.fold( | ||
(fail) { | ||
logError(fail); | ||
errorDetails = fail.toString(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're loosing a lot of info here by calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will update this to use ErrorDetails There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. created |
||
isAccountImportingError = true; | ||
return null; | ||
}, | ||
|
@@ -234,6 +240,7 @@ class AccountsStore { | |
await getBalances(selectedAccount.publicAddress); | ||
} catch (ex, stack) { | ||
logError(ex, stack); | ||
errorDetails = '$ex\n\nStackTrace:\n\n$stack'; | ||
isSendMoneyError = true; | ||
} | ||
isSendMoneyLoading = false; | ||
|
@@ -271,6 +278,7 @@ class AccountsStore { | |
mnemonic = await generateMnemonic(); | ||
} catch (ex, stack) { | ||
logError(ex, stack); | ||
errorDetails = '$ex\n\nStackTrace:\n\n$stack'; | ||
isMnemonicCreatingError = true; | ||
} | ||
isMnemonicCreating = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really sure why we're setting a variable as part of the build method, and why this variable is static? Looks like flutter team at google was a bit drunk when implemented this O.o. :D Wouldn't it make more sense to have specialized widget that is responsible of building the Error UI ? I think
ErrorWidget
is more meant for general build errors and altering it'sbuilder
field you're updating the way all build errors are being displayed across the whole app.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.flutter.dev/testing/errors, yes they were drunk, I figured it would be great if we had our own custom error screen app-wide, gets rid of the red screen of death and allows us to still copy error messages with one click of a button