libsbml icon indicating copy to clipboard operation
libsbml copied to clipboard

Add object sid in error messages

Open matthiaskoenig opened this issue 1 year ago • 2 comments

I am using SBML validation a lot. Often it is difficult to figure out what object creates the error in larger models. It would be very helpful to provide the sid and perhaps also the name name attribute for the object in the error message if these attributes are set.

I.e. currently the error message is for instance

ERROR    E0: SBML component consistency (core, L225, code)                                                                                                                                                     validation.py:189
         [Error] Invalid value for the 'units' attribute of a three-dimensional compartment                                                                                                                                     
         The value of the 'units' attribute on a <compartment> having 'spatialDimensions' of '3' is restricted.                                                                                                                 
         Reference: L3V2 Section 4.5.4                                                                                                                                                                                          
          The value of the 'units' attribute on a <compartment> having 'spatialDimensions' of '3' must be either 'volume', 'litre', or the identifier of a <unitDefinition> based on either 'litre', 'metre'                    
         (with 'exponent' equal to '3'), or 'dimensionless'.  

but would be much better as

ERROR    E0: SBML component consistency (core, L225, code)                                                                                                                                                     validation.py:189
         [Error] Invalid value for the 'units' attribute of a three-dimensional compartment with 'sid' of 'Vapical'                                                                                                                                  
         The value of the 'units' attribute on a <compartment> having 'spatialDimensions' of '3' is restricted.                                                                                                                 
         Reference: L3V2 Section 4.5.4                                                                                                                                                                                          
          The value of the 'units' attribute on a <compartment> having 'spatialDimensions' of '3' must be either 'volume', 'litre', or the identifier of a <unitDefinition> based on either 'litre', 'metre'                    
         (with 'exponent' equal to '3'), or 'dimensionless'.  

I.e. add the sid which directly allows to find the right object, here the right compartment.

matthiaskoenig avatar Sep 03 '24 09:09 matthiaskoenig

In general, we do indeed try to include the SIds and other identifying information in the error messages. We can fix these messages in particular, but as you find other errors without the SIds, let us know so we can find those and fix them, too.

luciansmith avatar Sep 03 '24 10:09 luciansmith

(Actually, if you could report the error number, that would make it easier to find.)

luciansmith avatar Sep 03 '24 10:09 luciansmith