ErrorHook behaviour

Hi,
I’ve been trying to use the mbed error hook in my system. while testing I found out that it will always halt the system(even when throwing a warning).

Is there a way to make the system not halt when throwing an error.
I expected the system to only halt when the error hook wasn’t implemented since it allows custom error handling.

I’ve currently implemented the hook as follows:

void System::mbedErrorHook(const mbed_error_ctx *errorContext)
{
    uint16_t errorCode = errorContext->error_status & MBED_ERROR_STATUS_CODE_MASK;
    switch (errorCode)
    {
    case MBED_ERROR_CODE_OUT_OF_MEMORY:
        System::getInstance()->setErrorCritical(MAIN_ERROR_OUT_OF_MEMORY);
        break;
    case MBED_ERROR_CODE_HARDFAULT_EXCEPTION:
        System::getInstance()->setErrorCritical(MAIN_ERROR_HARDFAULT_EXCEPTION);
        break;
    case MBED_ERROR_CODE_INVALID_ARGUMENT:
        printf("TEST");
        break;
    default:
        break;
    }
}

The hook gets set in the init of my system and tries to throw a warning in there aswell:

void System::init()
{
    mbed_set_error_hook(mbedErrorHook);
    setError(NO_ERROR);
    this->_UARTRS485 = new mbed::BufferedSerial(PB_6,        // PB_3 PB_4 || PB_6 PB_7
                                                PB_7);       // Serial port for UART connection to UI (via RS485)
    this->_UARTMC1 = new mbed::BufferedSerial(PC_10, PC_11); // Serial port for UART connection to Motorcontroller 14
    this->_UARTMC2 = new mbed::BufferedSerial(PC_12,
                                              PD_2); // Serial port for UART connection to Motorcontroller 2
    this->_spi1 = new mbed::SPI(PA_7, PA_6, PA_5);   // Serial port for SPI connection to HALL 1
    this->_Solenoid.mode(PullDown);                  // Initialize solenoid, set to pull down
    this->calculateAddress();

    this->initUartRs485();
    this->initUartMotorcontroller1();
    this->initUartMotorcontroller2();
    this->initSpi();
    MBED_WARNING(MBED_ERROR_INVALID_ARGUMENT, "HELP");
    _communicationThread.run();
    _eventThread.run();
    _motorControllerThread.run();
    _sensorThread.run();
}

TLDR: Is there a way to not halt the system when a warning gets handled by the errorhook