1515
1616import convex .core .ErrorCodes ;
1717import convex .core .Result ;
18+ import convex .core .SourceCodes ;
1819import convex .core .State ;
1920import convex .core .crypto .AKeyPair ;
2021import convex .core .data .ABlob ;
@@ -265,7 +266,7 @@ public long getSequence(Address addr) throws TimeoutException, IOException {
265266 public long lookupSequence (Address origin ) throws IOException , TimeoutException {
266267 AOp <ACell > code = Special .forSymbol (Symbols .STAR_SEQUENCE );
267268 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 );
269270 ACell rv =r .getValue ();
270271 if (!(rv instanceof CVMLong )) throw new RuntimeException ("Unexpected sequence result type: " +Utils .getClassName (rv ));
271272 long seq =((CVMLong )rv ).longValue ();
@@ -371,7 +372,7 @@ private synchronized long getNextSequence(ATransaction t) throws IOException, Ti
371372 * @throws IOException If an IO Exception occurs (most likely the connection is broken)
372373 * @throws TimeoutException In case of timeout
373374 */
374- public final synchronized CompletableFuture <Result > transact (ATransaction transaction ) throws IOException , TimeoutException {
375+ public final synchronized CompletableFuture <Result > transact (ATransaction transaction ) throws TimeoutException , IOException {
375376 SignedData <ATransaction > signed = prepareTransaction (transaction );
376377 CompletableFuture <Result > r = transact (signed );
377378 return r ;
@@ -388,7 +389,7 @@ public final synchronized CompletableFuture<Result> transact(ATransaction transa
388389 * @throws IOException If an IO Exception occurs (most likely the connection is broken)
389390 * @throws TimeoutException In case of timeout
390391 */
391- public SignedData <ATransaction > prepareTransaction (ATransaction transaction ) throws TimeoutException , IOException {
392+ public SignedData <ATransaction > prepareTransaction (ATransaction transaction ) throws IOException , TimeoutException {
392393 Address origin =transaction .getOrigin ();
393394 if (origin == null ) {
394395 origin =address ;
@@ -496,7 +497,7 @@ public synchronized Result transactSync(String code) throws IOException, Timeout
496497 * @return A Future for the result of the transaction
497498 * @throws IOException If the connection is broken or send buffer is full
498499 */
499- public abstract CompletableFuture <Result > transact (SignedData <ATransaction > signed ) throws IOException ;
500+ public abstract CompletableFuture <Result > transact (SignedData <ATransaction > signed );
500501
501502 /**
502503 * Submits a transfer transaction to the Convex network, returning a future once
@@ -587,7 +588,7 @@ public synchronized Result transactSync(ATransaction transaction, long timeout)
587588 return Result .fromException (e .getCause ());
588589 } catch (InterruptedException e ) {
589590 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 ) ;
591592 }
592593 }
593594
0 commit comments