Skip to content
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

Webview Server throws exception when builder only has one layer #225

Open
glass-ships opened this issue Nov 13, 2024 · 0 comments
Open

Webview Server throws exception when builder only has one layer #225

glass-ships opened this issue Nov 13, 2024 · 0 comments

Comments

@glass-ships
Copy link
Member

This probably makes sense in theory, if you're in the builder and delete layers until 1 layer is left, the server will throw (repeatedly) a very lengthy exception, including:

Traceback (most recent call last):
  File "/home/ge2/miniforge3/envs/refl1d/lib/python3.12/site-packages/bumps/serialize.py", line 95, in _rehydrate
    hydrated = _instantiate(klass, t, obj)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ge2/miniforge3/envs/refl1d/lib/python3.12/site-packages/bumps/serialize.py", line 116, in _instantiate
    raise e
  File "/home/ge2/miniforge3/envs/refl1d/lib/python3.12/site-packages/bumps/serialize.py", line 113, in _instantiate
    hydrated = class_factory(**s)
               ^^^^^^^^^^^^^^^^^^
  File "/home/ge2/dev/ornl/refl1d/refl1d/models/experiment.py", line 412, in __init__
    self._substrate = self.sample[0].material
                      ~~~~~~~~~~~^^^
  File "/home/ge2/dev/ornl/refl1d/refl1d/models/sample/layers.py", line 503, in __getitem__
    return stack._layers[idx]
           ~~~~~~~~~~~~~^^^^^
IndexError: list index out of range

And the final layer cannot be deleted.

From a refl1d perspective, I'm sure this makes sense, but from an app design perspective, the user should be able to delete however many layers they want, and rebuild it from the ground up if they desire.

It's a silent failure too, so the app doesn't crash or anything, but it would be nice to handle this more gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant