15
15
16
16
import convex .core .ErrorCodes ;
17
17
import convex .core .Result ;
18
+ import convex .core .SourceCodes ;
18
19
import convex .core .State ;
19
20
import convex .core .crypto .AKeyPair ;
20
21
import convex .core .data .ABlob ;
@@ -265,7 +266,7 @@ public long getSequence(Address addr) throws TimeoutException, IOException {
265
266
public long lookupSequence (Address origin ) throws IOException , TimeoutException {
266
267
AOp <ACell > code = Special .forSymbol (Symbols .STAR_SEQUENCE );
267
268
Result r = querySync (code ,origin );
268
- if (r .isError ()) throw new RuntimeException ("Error trying to get sequence number: " +r );
269
+ if (r .isError ()) throw new IOException ("Error trying to get sequence number: " +r );
269
270
ACell rv =r .getValue ();
270
271
if (!(rv instanceof CVMLong )) throw new RuntimeException ("Unexpected sequence result type: " +Utils .getClassName (rv ));
271
272
long seq =((CVMLong )rv ).longValue ();
@@ -371,7 +372,7 @@ private synchronized long getNextSequence(ATransaction t) throws IOException, Ti
371
372
* @throws IOException If an IO Exception occurs (most likely the connection is broken)
372
373
* @throws TimeoutException In case of timeout
373
374
*/
374
- public final synchronized CompletableFuture <Result > transact (ATransaction transaction ) throws IOException , TimeoutException {
375
+ public final synchronized CompletableFuture <Result > transact (ATransaction transaction ) throws TimeoutException , IOException {
375
376
SignedData <ATransaction > signed = prepareTransaction (transaction );
376
377
CompletableFuture <Result > r = transact (signed );
377
378
return r ;
@@ -388,7 +389,7 @@ public final synchronized CompletableFuture<Result> transact(ATransaction transa
388
389
* @throws IOException If an IO Exception occurs (most likely the connection is broken)
389
390
* @throws TimeoutException In case of timeout
390
391
*/
391
- public SignedData <ATransaction > prepareTransaction (ATransaction transaction ) throws TimeoutException , IOException {
392
+ public SignedData <ATransaction > prepareTransaction (ATransaction transaction ) throws IOException , TimeoutException {
392
393
Address origin =transaction .getOrigin ();
393
394
if (origin == null ) {
394
395
origin =address ;
@@ -496,7 +497,7 @@ public synchronized Result transactSync(String code) throws IOException, Timeout
496
497
* @return A Future for the result of the transaction
497
498
* @throws IOException If the connection is broken or send buffer is full
498
499
*/
499
- public abstract CompletableFuture <Result > transact (SignedData <ATransaction > signed ) throws IOException ;
500
+ public abstract CompletableFuture <Result > transact (SignedData <ATransaction > signed );
500
501
501
502
/**
502
503
* Submits a transfer transaction to the Convex network, returning a future once
@@ -587,7 +588,7 @@ public synchronized Result transactSync(ATransaction transaction, long timeout)
587
588
return Result .fromException (e .getCause ());
588
589
} catch (InterruptedException e ) {
589
590
Thread .currentThread ().interrupt (); // set interrupt flag since an interruption has occurred
590
- return Result .error (ErrorCodes .INTERRUPTED , "Transaction interrupted while awaiting result" );
591
+ return Result .error (ErrorCodes .INTERRUPTED , "Transaction interrupted while awaiting result" ). withSource ( SourceCodes . CLIENT ) ;
591
592
}
592
593
}
593
594
0 commit comments