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

Improve the error message when the phases key is missing from a YAML input file #812

Closed
bryanwweber opened this issue Feb 20, 2020 · 1 comment · Fixed by #880
Closed

Comments

@bryanwweber
Copy link
Member

As reported on the User's Group (https://groups.google.com/d/msg/cantera-users/2sNq2p-fVKM/-fSXMWA9CAAJ), a YAML input file that is missing a top-level phases key has a misleading error message:

CanteraError:
***********************************************************************
InputFileError thrown by AnyValue::getMapWhere:
Error on line 1 of /Users/bryan/Downloads/cantera.yaml:
Element is not a mapping or list of mappings
|  Line |
>     1 > species:
          ^
|     2 | - name: H
|     3 |   composition: {H: 1}
|     4 |   thermo:
***********************************************************************

It would be nice if this could be improved to point out the actual problem. Minimal YAML file:

species:
- name: H
  composition: {H: 1}
  thermo:
    model: NASA7
    temperature-ranges: [200.0, 1000.0, 6000.0]
    data:
    - [2.5, 0.0, 0.0, 0.0, 0.0, 2.547366e+04, -0.44668285]
    - [2.5, 0.0, 0.0, 0.0, 0.0, 2.547366e+04, -0.44668285]
    note: L6/94
@ischoegl
Copy link
Member

ischoegl commented Jun 26, 2020

@bryanwweber ... I proposed a fix in #880, and found also other instances where the error messages could be misleading (the behavior is caused by cython having incomplete C++ const support, with an error-throwing operator being shadowed by a permissive one). However, I'm not 100% sure of what 'missing' keywords should be allowed. nasa.yaml comes to mind ... Edit: Nevermind, argon.yaml works as expected, so #880 is good.

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 a pull request may close this issue.

2 participants