I purposely cause a divide by zero error. On the Feather, I see a core panic error message on the monitor and the device reboots, which is expected; however, on the Metro I do not get a core panic message and I’m not sure if the device reboots or not (the neo pixel blinks for a second so, so maybe).
Also, just to clarify, I’m not expecting to catch blocks to catch the error. I’m just looking for the core panic message.
In both cases, they are running the exact same code.
I have checked CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT in the sdkconfig file, and it is correctly set.
For what it’s worth, I’ve attached a copy of the test code.
Any thoughts would be appreciated.
Thanks,
Jack
Code: Select all
using namespace std;
#include <Arduino.h>
#include <exception>
#include <stdexcept>
////#define CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT 1
void setup()
{
Serial.begin(115200);
// while (!Serial)
// {
// delay(10);
// }
delay(2000);
Serial.println("\nESP32 Try-Catch Test\n");
Serial.flush();
delay(1000);
int x = 123;
int y = 0;
try
{
Serial.println("At Test");
Serial.print(x/y); // Force an error
//throw(99); // Caught in int
//throw("Oops..."); // Caught in catch-all
//throw runtime_error ("Oops RT"); // Caught in RT
}
catch(const std::runtime_error& e)
{
Serial.print("At runtime catch..."); Serial.println(e.what());
while(1) {}
}
catch(int)
{
Serial.print("At int catch...");
while(1) {}
}
catch(const std::exception& e)
{
Serial.print("At exception catch...");
Serial.println(e.what());
while(1) {}
}
catch(...)
{
Serial.println("At catch-all...");
while(1) {}
}
}
void loop()
{
Serial.println("At Loop...");
delay(500);
}