Lack of error message when a function is passed as an argument in a component in the initial layout

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context

  • pip list | grep dash below
dash                      2.9.3
dash-ag-grid              2.0.0a4
dash-bootstrap-components 1.4.0
dash-core-components      2.0.0
dash-design-kit           1.6.8
dash-enterprise-auth      0.0.5
dash-html-components      2.0.0
dash-iconify              0.1.2
dash-mantine-components   0.12.1
dash-snapshots            2.2.0
dash-table                5.0.0

Describe the bug

Passing a function as an argument (by mistake) causes an “Error Loading Layout” on the webpage with no description of the error.
example code:

import dash
from dash import dcc, html, Input, Output, State

app = dash.Dash()

def example_fun():

server = app.server
app.layout = html.Div([dcc.Graph(figure=example_fun)])    # should be example_fun()

if __name__ == "__main__":
    app.run_server(debug=True, port=8050)

Expected behavior

There should be a more descriptive error message such as “functions not supported as arguments”