erdc / proteus

A computational methods and simulation toolkit
http://proteustoolkit.org
MIT License
88 stars 56 forks source link

arguments_dict error messages improved #1230

Closed JohanMabille closed 4 years ago

JohanMabille commented 4 years ago

Mandatory Checklist

Please ensure that the following criteria are met:

As a general rule of thumb, try to follow PEP8 guidelines.

Description

This PR improves the error message you get when you try to get a scalar or a pyarray of the wrong type from the argument dictionary object.

Old behavior:

// The following is wrong, it should ask for a pyarray of double
xt::pyarray<int>& mesh_trial_ref = args.m_iarray["mesh_trial_ref"];
// Throws an error whose message is:
// mesh_trial_ref not found

New behavior:

// The following is wrong, it should ask for a pyarray of double
xt::pyarray<int>& mesh_trial_ref = args.array<int>("mesh_trial_ref");
// Throws an error whose message is:
// mesh_trial_ref not found in the dict of pyarray<int> but found in the dict of pyarray<double>
codecov[bot] commented 4 years ago

Codecov Report

Merging #1230 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1230   +/-   ##
=======================================
  Coverage   52.29%   52.29%           
=======================================
  Files         531      531           
  Lines      109524   109524           
=======================================
  Hits        57275    57275           
  Misses      52249    52249           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 07fa0a3...ad2594a. Read the comment docs.

JohanMabille commented 4 years ago

@cekees @zhang-alvin @tridelat this is ready for review.