esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Custom component doesn't compile anymore #3931

Open thimo-seitz opened 1 year ago

thimo-seitz commented 1 year ago

The problem

I'm using a custom sensor component with try-catch structures and this results with the update to 2022-10 to error: exception handling disabled, use -fexceptions to enable. esphome 2022.11.5 compiles and runs successfully.

I didn't find anything in the changelog which may cause that behavior.

Which version of ESPHome has the issue?

2022.12.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.12.6

What platform are you using?

ESP32

Board

nodemcu-32s

Component causing the issue

custom sensor

Example YAML snippet

---------------- uart_sensor.yaml ------------------
esphome:
  name: issue
  includes:
        - uart_sensor.h

#esp8266:
#  board: nodemcuv2
esp32:
  board: nodemcu-32s

# UART Schnittstelle
uart:
  - id: uart_bus
    baud_rate: 9600
    rx_pin: 1
    tx_pin: 2

sensor:
  # Custom UARTSensor
  - platform: custom
    lambda: |-
      auto my_custom_sensor = new UartSensor(id(uart_bus));
      App.register_component(my_custom_sensor);
      return {};
    sensors:

---------------- uart_sensor.h ------------------
#include "esphome.h"

class UartSensor : public Component, public UARTDevice {

  public:
    UartSensor(UARTComponent *parent) : UARTDevice(parent) {}

    void setup() override {
      // nothing to do here
    }

    void loop() override {
      try {
        // empty
      } catch(...) {
        // empty
      }
    }
};

Anything in the logs that might be useful for us?

error: exception handling disabled, use -fexceptions to enable

Additional information

No response

ssieb commented 1 year ago

I thought exceptions have been disabled for a long time. Don't use exceptions.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.