Skip to content

Commit

Permalink
Merge pull request #2753 from plotly/improve-layout-error
Browse files Browse the repository at this point in the history
Edit two error messages to suggest that users check for trailing commas
  • Loading branch information
red-patience authored Feb 9, 2024
2 parents 835da28 + 4a12177 commit f27810f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions dash/_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,11 @@ def validate_index(name, checks, index):
def validate_layout_type(value):
if not isinstance(value, (Component, patch_collections_abc("Callable"))):
raise exceptions.NoLayoutException(
"Layout must be a dash component "
"or a function that returns a dash component."
"""
Layout must be a single dash component
or a function that returns a dash component.
Cannot be a tuple (are there any trailing commas?)
"""
)


Expand Down
4 changes: 2 additions & 2 deletions dash/dash-renderer/src/utils/TreeContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export function validateComponent(componentDefinition: any) {
if (type(componentDefinition) === 'Array') {
throw new Error(
'The children property of a component is a list of lists, instead ' +
'of just a list. ' +
'Check the component that has the following contents, ' +
'of just a list. This can sometimes be due to a trailing comma. ' +
'Check the component that has the following contents ' +
'and remove one of the levels of nesting: \n' +
JSON.stringify(componentDefinition, null, 2)
);
Expand Down

0 comments on commit f27810f

Please # to comment.