Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
durt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libs
durt
Commits
6495f4bc
Commit
6495f4bc
authored
2 years ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Allow to conditionally raise an exception or not
parent
ae180ae2
No related branches found
No related tags found
1 merge request
!1
History, deps updated and correct exception parsing
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/durt.dart
+1
-0
1 addition, 0 deletions
lib/durt.dart
lib/src/gva/gva.dart
+3
-2
3 additions, 2 deletions
lib/src/gva/gva.dart
lib/src/gva/transaction.dart
+4
-1
4 additions, 1 deletion
lib/src/gva/transaction.dart
with
8 additions
and
3 deletions
lib/durt.dart
+
1
−
0
View file @
6495f4bc
...
...
@@ -21,3 +21,4 @@ export 'src/crypto/dewif.dart'
show
Dewif
,
randomSecretCode
,
ChecksumException
,
NewWallet
;
export
'src/crypto/cesium_wallet.dart'
show
CesiumWallet
;
export
'src/gva/gva.dart'
show
Gva
;
export
'src/gva/transaction.dart'
show
GraphQLException
;
This diff is collapsed.
Click to expand it.
lib/src/gva/gva.dart
+
3
−
2
View file @
6495f4bc
...
...
@@ -96,7 +96,7 @@ class Gva {
int
?
derivation
,
String
comment
=
''
,
bool
ud
=
false
,
bool
useMempool
=
false
})
async
{
bool
useMempool
=
false
,
bool
raiseException
=
false
})
async
{
Transaction
transaction
;
if
(
ud
)
{
...
...
@@ -120,7 +120,7 @@ class Gva {
client:
_client
);
// Execute transaction
return
await
transaction
.
process
();
return
await
transaction
.
process
(
raiseException
);
}
Future
<
Map
<
String
,
dynamic
>
?
>
history
(
String
pubkey
,[
int
?
pageSize
,
String
?
cursor
])
async
{
...
...
@@ -140,6 +140,7 @@ class Gva {
}
else
if
(
result
.
data
!=
null
)
{
return
result
.
data
;
}
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/src/gva/transaction.dart
+
4
−
1
View file @
6495f4bc
...
...
@@ -193,7 +193,7 @@ class Transaction {
return
false
;
}
Future
<
String
>
process
()
async
{
Future
<
String
>
process
(
[
bool
raiseException
=
false
]
)
async
{
try
{
final
List
transDocs
=
await
_generateTransactionDocument
();
if
(
_checkTransactionDocument
(
transDocs
))
{
...
...
@@ -204,6 +204,9 @@ class Transaction {
return
'Transaction document is not valid.'
;
}
}
on
GraphQLException
catch
(
e
)
{
if
(
raiseException
)
{
rethrow
;
}
List
<
String
>
eCause
=
e
.
cause
.
split
(
'message: '
);
return
eCause
.
isNotEmpty
?
eCause
[
eCause
.
length
>
1
?
1
:
0
]
.
split
(
','
)[
0
]
:
'Transaction failed for unknown reason'
;
}
on
MySelfException
catch
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment