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

add a better error. #1846

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

thorstenhater
Copy link
Contributor

@thorstenhater thorstenhater commented Feb 24, 2022

Since we have support for ACC loading the errors thrown by paint are no longer
sufficiently informative. Even before that it was already hard to correlate source
and locus of painting errors.

Example

$> python3 main.C51A.py
Traceback (most recent call last):
  File "main.C51A.py", line 33, in <module>
    cell = A.cable_cell(morph, labels, decor)
RuntimeError: cable_cell: cable (cable 6 0 1) overpaints

This adds more details to the error message

$> python3 main.C51A.py
Traceback (most recent call last):
  File "main.C51A.py", line 33, in <module>
    cell = A.cable_cell(morph, labels, decor)
RuntimeError: cable_cell: Setting property 'ion-reversal-potential' on region '(region "soma_group")' overpaints at '(cable 6 0 1)'

Copy link
Contributor

@noraabiakar noraabiakar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks! One small suggestion on what we can print.

arbor/cable_cell_param.cpp Outdated Show resolved Hide resolved
[&] (const auto& p) {
using T = std::decay_t<decltype(p)>;
if constexpr (std::is_same_v<init_membrane_potential, T>) {
os << "init-membrane-potential";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been printing everything in the decor part of the code as s-expressions, so maybe it's worth sticking to that style? Also we could print the value while we're at it.
Something like (init-membrane-potential -65).

Copy link
Contributor Author

@thorstenhater thorstenhater Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberated on the same question, here's what I swayed me against

  1. telling what might be enough information
  2. ...and not overloading the reader, the line is quite long already.
  3. also, where to draw the line? (density ('name' (...)))? Or print all the parameters?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Should we keep it out of the public header as it's not printing the "full" information about the class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good point to think about. It just prints the outer DSL constructor in s-exp-speak.
At some point we had opened an issue on a 'general object printing facility', maybe it's
a good time to take that a bit seriously?

For now, I'll change << to print_paintable and hide it.

Copy link
Contributor

@brenthuisman brenthuisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent.

@noraabiakar noraabiakar merged commit a365e6e into arbor-sim:master Mar 16, 2022
@thorstenhater thorstenhater deleted the ux/better-overpaint-error branch August 1, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants