-
Notifications
You must be signed in to change notification settings - Fork 6
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
Some error messages are not very helpful #383
Comments
Do you have an example where the error is hard to read? I just checked the error messages folks will get if they try to use an old-style pulse with demes 0.2.0 and they seem ok to me. # p.py
import demes
b = demes.Builder()
b.add_deme("a", epochs=[dict(start_size=1)])
b.add_deme("b", epochs=[dict(start_size=1)])
b.add_pulse(source="a", dest="b", proportion=0.1, time=100)
# p.yaml
time_units: generations
demes:
- name: a
epochs:
- start_size: 1
- name: b
epochs:
- start_size: 1
pulses:
- {source: a, dest: b, time: 100, proportion: 0.1}
Having the But maybe you're thinking of more complex problems? # p2.yaml
time_units: generations
demes:
- name: a
epochs:
- start_size: 1
- name: b
ancestors: [a]
start_time: 50
epochs:
- start_size: 1
pulses:
- {sources: [a], dest: b, time: 100, proportions: [0.1]}
The last error is quite terse, but in combination with the earlier error, this is quite informative. Though I admit, it would be nicer if the info was all printed in one exception. Is this what you mean? Any ideas about how we might go about improving this? |
You're right - most error messages are actually very clear what the problem is. I quickly jotted down this issue with this discussion over in msprime in mind: tskit-dev/msprime#1918 Here, an input graph had a pulse with a list as the dest, instead of a single deme name as a string. For example: import demes
b = demes.Builder()
b.add_deme("a", epochs=[dict(start_size=1)])
b.add_deme("b", epochs=[dict(start_size=1)])
b.add_pulse(sources=["a"], dest=["b"], proportions=0.1, time=[100])
g = b.resolve() results in the following, which was not descriptive enough for the user to know what the problem was:
|
That is quite cryptic. We couldy replace all the dict |
For example, an
add_pulse
that fails will often just sayTypeError: pulse[0]: invalid pulse
. It would be much more helpful to know why it failed, or at least which field was input improperly.The text was updated successfully, but these errors were encountered: