Remove THROW from lib mode handlers and remove associated TRY CATCH context

This commit is contained in:
Francois Beutin
2023-12-01 12:38:48 +01:00
parent 8e3fd4233a
commit f64addc0d2
7 changed files with 72 additions and 74 deletions

View File

@@ -7,13 +7,14 @@
#include <stdint.h>
#include <os.h>
int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain_config_t* config) {
void handle_get_printable_amount(get_printable_amount_parameters_t* params,
chain_config_t* config) {
uint8_t decimals;
char ticker[MAX_TICKER_LEN];
memset(params->printable_amount, 0, sizeof(params->printable_amount));
if (params->amount_length > 32) {
PRINTF("Amount is too big, 32 bytes max but buffer has %u bytes", params->amount_length);
return 0;
return;
}
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
@@ -29,7 +30,7 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain
ticker,
&decimals)) {
PRINTF("Error while parsing config\n");
return 0;
return;
}
}
@@ -39,7 +40,7 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain
ticker,
params->printable_amount,
sizeof(params->printable_amount))) {
THROW(EXCEPTION_OVERFLOW);
memset(params->printable_amount, 0, sizeof(params->printable_amount));
}
return 1;
return;
}