Change exception text and type

This commit is contained in:
Lucian Copeland 2020-05-27 11:48:52 -04:00
parent 75b5142954
commit 1e914ac2b0
2 changed files with 4 additions and 4 deletions

View File

@ -157,7 +157,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
if (spi_taken) {
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
} else {
mp_raise_ValueError(translate("Invalid SPI pin selection"));
mp_raise_ValueError(translate("Invalid pins"));
}
}

View File

@ -143,15 +143,15 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
}
if (uart_taken) {
mp_raise_RuntimeError(translate("Hardware in use, try alternative pins"));
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
}
if(self->rx == NULL && self->tx == NULL) {
mp_raise_RuntimeError(translate("Invalid UART pin selection"));
mp_raise_ValueError(translate("Invalid pins"));
}
if (is_onedirection && ((rts != NULL) || (cts != NULL))) {
mp_raise_RuntimeError(translate("Both RX and TX required for flow control"));
mp_raise_ValueError(translate("Both RX and TX required for flow control"));
}
// Filter for sane settings for RS485