Skip to content

Commit 0f67365

Browse files
tysonwilclaude
andauthored
feat: add error handling examples and tests for SDK clarity (#103)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2f6e7c5 commit 0f67365

15 files changed

Lines changed: 128 additions & 13 deletions

File tree

Binary file not shown.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"images": [
2+
"images" : [
33
{
4-
"filename": "App-Icon-1024x1024@1x.png",
5-
"idiom": "universal",
6-
"platform": "ios",
7-
"size": "1024x1024"
4+
"filename" : "image.png",
5+
"idiom" : "universal",
6+
"platform" : "ios",
7+
"size" : "1024x1024"
88
}
99
],
10-
"info": {
11-
"version": 1,
12-
"author": "expo"
10+
"info" : {
11+
"author" : "xcode",
12+
"version" : 1
1313
}
14-
}
14+
}
509 KB
Loading

mobile/with-flutter/lib/features/wallets/screens/details/cosmos_wallet_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ class _CosmosWalletViewState extends State<CosmosWalletView> {
763763
Widget build(BuildContext context) {
764764
final theme = Theme.of(context);
765765
return Scaffold(
766+
key: const Key('walletDetailView'),
766767
backgroundColor: theme.scaffoldBackgroundColor,
767768
appBar: AppBar(
768769
backgroundColor: theme.scaffoldBackgroundColor,

mobile/with-flutter/lib/features/wallets/screens/details/evm_wallet_view.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ class _EVMWalletViewState extends State<EVMWalletView> {
345345
@override
346346
Widget build(BuildContext context) {
347347
return Scaffold(
348+
key: const Key('walletDetailView'),
348349
backgroundColor: Theme.of(context).colorScheme.surface,
349350
appBar: AppBar(
350351
backgroundColor: Theme.of(context).colorScheme.surface,
@@ -506,6 +507,7 @@ class _EVMWalletViewState extends State<EVMWalletView> {
506507
SizedBox(
507508
width: double.infinity,
508509
child: ElevatedButton(
510+
key: const Key('signMessageButton'),
509511
onPressed: _isLoading || _messageToSign.isEmpty
510512
? null
511513
: _signMessage,

mobile/with-flutter/lib/features/wallets/screens/details/solana_wallet_view.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class _SolanaWalletViewState extends State<SolanaWalletView> {
356356
@override
357357
Widget build(BuildContext context) {
358358
return Scaffold(
359+
key: const Key('walletDetailView'),
359360
backgroundColor: Theme.of(context).colorScheme.surface,
360361
appBar: AppBar(
361362
backgroundColor: Theme.of(context).colorScheme.surface,
@@ -575,6 +576,7 @@ class _SolanaWalletViewState extends State<SolanaWalletView> {
575576
const SizedBox(width: 12),
576577
Expanded(
577578
child: ElevatedButton(
579+
key: const Key('signTransactionButton'),
578580
onPressed: _isLoading ? null : _signTransaction,
579581
style: ElevatedButton.styleFrom(
580582
backgroundColor: Colors.grey[300],

mobile/with-flutter/lib/features/wallets/widgets/wallet_card.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class WalletCard extends StatelessWidget {
1717
final chain = wallet.type?.toChain ?? WalletChain.evm;
1818

1919
return GestureDetector(
20+
key: Key('walletCell_${wallet.type?.value ?? 'unknown'}'),
2021
onTap: onTap,
2122
child: Container(
2223
height: 150,

mobile/with-flutter/lib/screens/auth_screen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class _AuthScreenState extends State<AuthScreen> {
358358
const SizedBox(height: 24),
359359
// Email/Phone input
360360
EmailPhoneInput(
361+
key: const Key('emailPhoneInput'),
361362
onSubmit: _isProcessing ? (_, __) {} : _handleEmailPhone,
362363
),
363364
const SizedBox(height: 20),

mobile/with-flutter/test_e2e/tool/run_tests.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ void main(List<String> args) async {
4949
case 'wallets':
5050
testFiles = ['evm_wallet_test.dart', 'solana_wallet_test.dart', 'cosmos_wallet_test.dart'];
5151
break;
52+
case 'error':
53+
case 'errors':
54+
testFiles = ['simple_error_test.dart'];
55+
break;
5256
case 'all':
5357
default:
5458
testFiles = [
5559
'authentication_test.dart',
5660
'evm_wallet_test.dart',
5761
'solana_wallet_test.dart',
58-
'cosmos_wallet_test.dart'
62+
'cosmos_wallet_test.dart',
63+
'simple_error_test.dart'
5964
];
6065
break;
6166
}

mobile/with-swift/example/Auth/AuthView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ struct AuthView: View {
218218
}
219219
} catch {
220220
// Handle any errors
221-
errorMessage = error.localizedDescription
221+
errorMessage = (error as? LocalizedError)?.errorDescription ?? error.localizedDescription
222222
showErrorAlert = true
223223
}
224224
}

0 commit comments

Comments
 (0)