Skip to content

Commit

Permalink
fix: error log level for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 16, 2023
1 parent 20016e7 commit 49390be
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/client/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class AcirSimulator {
}

if (request.origin !== contractAddress) {
this.log(`WARN: Request origin does not match contract address in simulation`);
this.log.warn('Request origin does not match contract address in simulation');
}

const curve = await Grumpkin.new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class UnconstrainedFunctionExecution {
storageRead: async ([slot], [numberOfElements]) => {
if (!aztecNode) {
const errMsg = `Aztec node is undefined, cannot read storage`;
this.log(errMsg);
this.log.error(errMsg);
throw new Error(errMsg);
}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class Synchroniser {

this.synchedToBlock = latestBlock.block.number;
} catch (err) {
this.log(err);
this.log.error(err);
await this.interruptableSleep.sleep(retryInterval);
}
}
Expand Down Expand Up @@ -186,7 +186,7 @@ export class Synchroniser {
this.noteProcessors.push(noteProcessor);
}
} catch (err) {
this.log(err);
this.log.error(err);
await this.interruptableSleep.sleep(retryInterval);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ main()
process.exit(0);
})
.catch(err => {
logger('Error in main fn: ', err);
logger.error('Error in main fn: ', err);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,6 @@ main()
process.exit(0);
})
.catch(err => {
logger('Error in main fn: ', err);
logger.error('Error in main fn: ', err);
process.exit(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('e2e_public_token_contract', () => {
expect(txReceipt.status).toEqual(TxStatus.MINED);
}, 30_000);

it('should deploy a public token contract and mint tokens to a recipient', async () => {
it.only('should deploy a public token contract and mint tokens to a recipient', async () => {
const mintAmount = 359n;

await deployContract();
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/fifo/bounded_serial_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class BoundedSerialQueue {
}
})
.catch(err => {
this.log('BoundedSerialQueue handler exception:', err);
this.log.error('BoundedSerialQueue handler exception:', err);
});
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/fifo/memory_fifo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class MemoryFifo<T> {
await handler(item);
}
} catch (err) {
this.log('Queue handler exception:', err);
this.log.error('Queue handler exception:', err);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ export class JsonRpcServer {
try {
await next();
} catch (err: any) {
this.log(err);
this.log.error(err);
ctx.status = 400;
ctx.body = { error: err.message };
}
};
const app = new Koa();
app.on('error', error => {
this.log(`KOA app-level error. ${convertBigintsInObj({ error })}`);
this.log.error(`KOA app-level error. ${JSON.stringify({ error })}`);
});
app.use(compress({ br: false } as any));
app.use(bodyParser());
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/retry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function retry<Result>(
throw err;
}
log(`${name} failed. Will retry in ${s}s...`);
log(err);
log.error(err);
await sleep(s * 1000);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree {
resolve();
})
.on('error', function () {
log('stream error');
log.error('stream error');
reject();
});
});
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p-bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ async function main() {
}

main().catch(err => {
logger(err);
logger.error(err);
});
14 changes: 7 additions & 7 deletions yarn-project/p2p/src/service/libp2p_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class LibP2PService implements P2PService {
}
await this.processMessage(message, peer);
} catch (err) {
this.logger(
this.logger.error(
`Failed to handle received message from peer ${incomingStreamData.connection.remotePeer.toString()}`,
err,
);
Expand Down Expand Up @@ -274,7 +274,7 @@ export class LibP2PService implements P2PService {
}
await this.sendGetTransactionsMessageToPeer(txHashes, peerId);
} catch (err) {
this.logger(`Failed to process received tx hashes`, err);
this.logger.error(`Failed to process received tx hashes`, err);
}
}

Expand All @@ -290,7 +290,7 @@ export class LibP2PService implements P2PService {
}
await this.sendTransactionsMessageToPeer(txs, peerId);
} catch (err) {
this.logger(`Failed to process get txs request`, err);
this.logger.error(`Failed to process get txs request`, err);
}
}

Expand All @@ -303,7 +303,7 @@ export class LibP2PService implements P2PService {
await this.processTxFromPeer(tx, peerId);
}
} catch (err) {
this.logger(`Failed to process pooled transactions message`, err);
this.logger.error(`Failed to process pooled transactions message`, err);
}
}

Expand Down Expand Up @@ -332,7 +332,7 @@ export class LibP2PService implements P2PService {
await this.sendRawMessageToPeer(payload, peer);
this.knownTxLookup.addPeerForTx(peer, txHashString);
} catch (err) {
this.logger(`Failed to send txs to peer ${peer.toString()}`, err);
this.logger.error(`Failed to send txs to peer ${peer.toString()}`, err);
continue;
}
}
Expand All @@ -347,7 +347,7 @@ export class LibP2PService implements P2PService {
const message = createTransactionHashesMessage(hashes);
await this.sendRawMessageToPeer(new Uint8Array(message), peer);
} catch (err) {
this.logger(`Failed to send tx hashes to peer ${peer.toString()}`, err);
this.logger.error(`Failed to send tx hashes to peer ${peer.toString()}`, err);
}
}

Expand All @@ -356,7 +356,7 @@ export class LibP2PService implements P2PService {
const message = createGetTransactionsRequestMessage(hashes);
await this.sendRawMessageToPeer(new Uint8Array(message), peer);
} catch (err) {
this.logger(`Failed to send tx request to peer ${peer.toString()}`, err);
this.logger.error(`Failed to send tx request to peer ${peer.toString()}`, err);
}
}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/rollup-provider/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function appFactory(node: AztecNode, prefix: string) {
try {
await next();
} catch (err: any) {
logger(err);
logger.error(err);
ctx.status = 400;
ctx.body = { error: err.message };
}
Expand Down Expand Up @@ -258,7 +258,7 @@ export function appFactory(node: AztecNode, prefix: string) {

const app = new Koa();
app.on('error', error => {
logger(`KOA app-level error. ${JSON.stringify({ error })}`);
logger.error(`KOA app-level error. ${JSON.stringify({ error })}`);
});
app.proxy = true;
app.use(exceptionHandler);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/rollup-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ async function main() {
}

main().catch(err => {
logger(err);
logger.error(err);
process.exit(1);
});
4 changes: 2 additions & 2 deletions yarn-project/sequencer-client/src/publisher/l1-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class L1Publisher implements L2BlockReceiver {
try {
return await this.txSender.sendEmitContractDeploymentTx(l2BlockNum, l2BlockHash, contractData);
} catch (err) {
this.log(`Error sending contract data to L1`, err);
this.log.error(`Error sending contract data to L1`, err);
await this.sleepOrInterrupted();
}
}
Expand All @@ -232,7 +232,7 @@ export class L1Publisher implements L2BlockReceiver {
try {
return await this.txSender.getTransactionReceipt(txHash);
} catch (err) {
//this.log(`Error getting tx receipt`, err);
//this.log.error(`Error getting tx receipt`, err);
await this.sleepOrInterrupted();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class L2BlockDownloader {
this.queue.put(blocks);
this.from += blocks.length;
} catch (err) {
log(err);
log.error(err);
await this.interruptableSleep.sleep(this.pollIntervalMS);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('server_world_state_synchroniser', () => {
nextBlocks = [getMockBlock(currentBlockNumber + 1)];

// start the sync process but don't await
server.start().catch(err => log('Sync not completed: ', err));
server.start().catch(err => log.error('Sync not completed: ', err));

// now setup a loop to monitor the sync progress and push new blocks in
while (currentBlockNumber <= LATEST_BLOCK_NUMBER) {
Expand Down

0 comments on commit 49390be

Please sign in to comment.