Skip to content

Commit

Permalink
feat: error for process execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Baneeishaque committed Nov 17, 2024
1 parent cc31a2e commit 029fcc5
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 33 deletions.
16 changes: 13 additions & 3 deletions lib/process_gist_v2_account_ledger_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
import 'package:args/command_runner.dart';
import 'package:tuple/tuple.dart';

class ProcessGistV2AccountLedgerCommand extends Command {
@override
Expand All @@ -15,14 +16,23 @@ class ProcessGistV2AccountLedgerCommand extends Command {

@override
Future<void> run() async {
await processAccountLedgerGistV2InterActive(AccountLedgerGistV2Model.fromJson(
jsonDecode(runAccountLedgerGistV2Operation(
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV2Operation(
actionsBeforeExecution: () {
print('Running GistV2 Operation');
},
actionsAfterExecution: (String result) {
// print('Result : $result');
},
))));
);
if (gistOperationResult.item1) {
await processAccountLedgerGistV2InterActive(
AccountLedgerGistV2Model.fromJson(
jsonDecode(gistOperationResult.item2),
),
);
} else {
print("Gist Operation Failure...");
print(gistOperationResult.item2);
}
}
}
33 changes: 19 additions & 14 deletions lib/process_gist_v3_account_ledger_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
import 'package:args/command_runner.dart';
import 'package:tuple/tuple.dart';

class ProcessGistV3AccountLedgerCommand extends Command {
@override
Expand All @@ -15,20 +16,24 @@ class ProcessGistV3AccountLedgerCommand extends Command {

@override
Future<void> run() async {
await processAccountLedgerGistV2InterActive(
AccountLedgerGistV2Model.fromJson(
jsonDecode(
runAccountLedgerGistV3Operation(
actionsBeforeExecution: () {
print('Running GistV3 Operation');
},
actionsAfterExecution: (String result) {
// print('Result : $result');
},
),
),
),
isVersion3: true,
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV3Operation(
actionsBeforeExecution: () {
print('Running GistV3 Operation');
},
actionsAfterExecution: (String result) {
// print('Result : $result');
},
);
if (gistOperationResult.item1) {
await processAccountLedgerGistV2InterActive(
AccountLedgerGistV2Model.fromJson(
jsonDecode(gistOperationResult.item2),
),
isVersion3: true,
);
} else {
print("Gist Operation Failure...");
print(gistOperationResult.item2);
}
}
}
33 changes: 19 additions & 14 deletions lib/process_gist_v4_account_ledger_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:account_ledger_library/account_ledger_gist_api.dart';
import 'package:account_ledger_library/account_ledger_gist_api_interactive.dart';
import 'package:account_ledger_library/models/account_ledger_gist_model_v2.dart';
import 'package:args/command_runner.dart';
import 'package:tuple/tuple.dart';

class ProcessGistV4AccountLedgerCommand extends Command {
@override
Expand All @@ -15,20 +16,24 @@ class ProcessGistV4AccountLedgerCommand extends Command {

@override
Future<void> run() async {
await processAccountLedgerGistV2InterActive(
AccountLedgerGistV2Model.fromJson(
jsonDecode(
runAccountLedgerGistV4Operation(
actionsBeforeExecution: () {
print('Running GistV4 Operation');
},
actionsAfterExecution: (String result) {
// print('Result : $result');
},
),
),
),
isVersion3: true,
Tuple2<bool, String> gistOperationResult = runAccountLedgerGistV4Operation(
actionsBeforeExecution: () {
print('Running GistV4 Operation');
},
actionsAfterExecution: (String result) {
// print('Result : $result');
},
);
if (gistOperationResult.item1) {
await processAccountLedgerGistV2InterActive(
AccountLedgerGistV2Model.fromJson(
jsonDecode(gistOperationResult.item2),
),
isVersion3: true,
);
} else {
print("Gist Operation Failure...");
print(gistOperationResult.item2);
}
}
}
10 changes: 9 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
dotenv:
dependency: transitive
description:
name: dotenv
sha256: "379e64b6fc82d3df29461d349a1796ecd2c436c480d4653f3af6872eccbc90e1"
url: "https://pub.dev"
source: hosted
version: "4.2.0"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -369,7 +377,7 @@ packages:
source: hosted
version: "0.6.0"
tuple:
dependency: transitive
dependency: "direct main"
description:
name: tuple
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
args: ^2.4.2
account_ledger_library:
path: account_ledger_library_dart
tuple: ^2.0.2

dev_dependencies:
lints: ^3.0.0
Expand Down

0 comments on commit 029fcc5

Please sign in to comment.