Skip to content

Bare Exceptions #304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
T4rk1n opened this issue Jul 26, 2018 · 1 comment
Closed

Bare Exceptions #304

T4rk1n opened this issue Jul 26, 2018 · 1 comment
Assignees
Labels
feature something new

Comments

@T4rk1n
Copy link
Contributor

T4rk1n commented Jul 26, 2018

Currently, there is a couple bare Exception that are raised by dash, they should be refactored into appropriate DashException.

Should be a TypeError or NoLayoutException:

dash/dash/dash.py

Lines 197 to 203 in 54ca4a3

if (not isinstance(value, Component) and
not isinstance(value, collections.Callable)):
raise Exception(
''
'Layout must be a dash component '
'or a function that returns '
'a dash component.')

A new exception type InvalidIndexException:

dash/dash/dash.py

Lines 224 to 229 in 54ca4a3

if missing:
raise Exception(
'Did you forget to include {} in your index string ?'.format(
', '.join('{%' + x + '%}' for x in missing)
)
)

dash/dash/dash.py

Lines 409 to 415 in 54ca4a3

plural = 's' if len(missing) > 1 else ''
raise Exception(
'Missing element{pl} {ids} in index.'.format(
ids=', '.join(missing),
pl=plural
)
)

A new exception type DependencyException:

dash/dash/dash.py

Lines 357 to 374 in 54ca4a3

if package_name not in self.registered_paths:
raise Exception(
'Error loading dependency.\n'
'"{}" is not a registered library.\n'
'Registered libraries are: {}'
.format(package_name, list(self.registered_paths.keys())))
elif path_in_package_dist not in self.registered_paths[package_name]:
raise Exception(
'"{}" is registered but the path requested is not valid.\n'
'The path requested: "{}"\n'
'List of registered paths: {}'
.format(
package_name,
path_in_package_dist,
self.registered_paths
)
)

ResourceException ?:

dash/dash/resources.py

Lines 42 to 48 in 54ca4a3

raise Exception(
'{} does not have a '
'relative_package_path, absolute_path, or an '
'external_url.'.format(
json.dumps(filtered_resource)
)
)

@shammamah-zz shammamah-zz self-assigned this Nov 29, 2018
@shammamah-zz shammamah-zz mentioned this issue Dec 10, 2018
16 tasks
@ned2
Copy link
Contributor

ned2 commented Dec 16, 2018

@shammamah, just spotted one that slipped through. Sorry to be a bit late before you merged the PR. On line 400:

raise Exception(
    'Serving files from absolute_path isn\'t supported yet'
)

Perhaps NotImplementedException or NotSupportedYetExcpetion

HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
@gvwilson gvwilson assigned T4rk1n and marthacryan and unassigned shammamah-zz Aug 7, 2024
@gvwilson gvwilson added the feature something new label Aug 7, 2024
@T4rk1n T4rk1n closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

5 participants