Skip to content

Commit 029fcc5

Browse files
committed
feat: error for process execution
1 parent cc31a2e commit 029fcc5

6 files changed

+62
-33
lines changed

lib/process_gist_v2_account_ledger_command.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
44
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
55
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
66
import 'package:args/command_runner.dart';
7+
import 'package:tuple/tuple.dart';
78

89
class ProcessGistV2AccountLedgerCommand extends Command {
910
@override
@@ -15,14 +16,23 @@ class ProcessGistV2AccountLedgerCommand extends Command {
1516

1617
@override
1718
Future<void> run() async {
18-
await processAccountLedgerGistV2InterActive(AccountLedgerGistV2Model.fromJson(
19-
jsonDecode(runAccountLedgerGistV2Operation(
19+
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV2Operation(
2020
actionsBeforeExecution: () {
2121
print('Running GistV2 Operation');
2222
},
2323
actionsAfterExecution: (String result) {
2424
// print('Result : $result');
2525
},
26-
))));
26+
);
27+
if (gistOperationResult.item1) {
28+
await processAccountLedgerGistV2InterActive(
29+
AccountLedgerGistV2Model.fromJson(
30+
jsonDecode(gistOperationResult.item2),
31+
),
32+
);
33+
} else {
34+
print("Gist Operation Failure...");
35+
print(gistOperationResult.item2);
36+
}
2737
}
2838
}

lib/process_gist_v3_account_ledger_command.dart

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
44
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
55
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
66
import 'package:args/command_runner.dart';
7+
import 'package:tuple/tuple.dart';
78

89
class ProcessGistV3AccountLedgerCommand extends Command {
910
@override
@@ -15,20 +16,24 @@ class ProcessGistV3AccountLedgerCommand extends Command {
1516

1617
@override
1718
Future<void> run() async {
18-
await processAccountLedgerGistV2InterActive(
19-
AccountLedgerGistV2Model.fromJson(
20-
jsonDecode(
21-
runAccountLedgerGistV3Operation(
22-
actionsBeforeExecution: () {
23-
print('Running GistV3 Operation');
24-
},
25-
actionsAfterExecution: (String result) {
26-
// print('Result : $result');
27-
},
28-
),
29-
),
30-
),
31-
isVersion3: true,
19+
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV3Operation(
20+
actionsBeforeExecution: () {
21+
print('Running GistV3 Operation');
22+
},
23+
actionsAfterExecution: (String result) {
24+
// print('Result : $result');
25+
},
3226
);
27+
if (gistOperationResult.item1) {
28+
await processAccountLedgerGistV2InterActive(
29+
AccountLedgerGistV2Model.fromJson(
30+
jsonDecode(gistOperationResult.item2),
31+
),
32+
isVersion3: true,
33+
);
34+
} else {
35+
print("Gist Operation Failure...");
36+
print(gistOperationResult.item2);
37+
}
3338
}
3439
}

lib/process_gist_v4_account_ledger_command.dart

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
44
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
55
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
66
import 'package:args/command_runner.dart';
7+
import 'package:tuple/tuple.dart';
78

89
class ProcessGistV4AccountLedgerCommand extends Command {
910
@override
@@ -15,20 +16,24 @@ class ProcessGistV4AccountLedgerCommand extends Command {
1516

1617
@override
1718
Future<void> run() async {
18-
await processAccountLedgerGistV2InterActive(
19-
AccountLedgerGistV2Model.fromJson(
20-
jsonDecode(
21-
runAccountLedgerGistV4Operation(
22-
actionsBeforeExecution: () {
23-
print('Running GistV4 Operation');
24-
},
25-
actionsAfterExecution: (String result) {
26-
// print('Result : $result');
27-
},
28-
),
29-
),
30-
),
31-
isVersion3: true,
19+
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV4Operation(
20+
actionsBeforeExecution: () {
21+
print('Running GistV4 Operation');
22+
},
23+
actionsAfterExecution: (String result) {
24+
// print('Result : $result');
25+
},
3226
);
27+
if (gistOperationResult.item1) {
28+
await processAccountLedgerGistV2InterActive(
29+
AccountLedgerGistV2Model.fromJson(
30+
jsonDecode(gistOperationResult.item2),
31+
),
32+
isVersion3: true,
33+
);
34+
} else {
35+
print("Gist Operation Failure...");
36+
print(gistOperationResult.item2);
37+
}
3338
}
3439
}

pubspec.lock

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ packages:
8888
url: "https://pub.dev"
8989
source: hosted
9090
version: "3.0.3"
91+
dotenv:
92+
dependency: transitive
93+
description:
94+
name: dotenv
95+
sha256: "379e64b6fc82d3df29461d349a1796ecd2c436c480d4653f3af6872eccbc90e1"
96+
url: "https://pub.dev"
97+
source: hosted
98+
version: "4.2.0"
9199
file:
92100
dependency: transitive
93101
description:
@@ -369,7 +377,7 @@ packages:
369377
source: hosted
370378
version: "0.6.0"
371379
tuple:
372-
dependency: transitive
380+
dependency: "direct main"
373381
description:
374382
name: tuple
375383
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
args: ^2.4.2
1212
account_ledger_library:
1313
path: account_ledger_library_dart
14+
tuple: ^2.0.2
1415

1516
dev_dependencies:
1617
lints: ^3.0.0

0 commit comments

Comments
 (0)