juergbi commented on code in PR #2089:
URL: https://github.com/apache/buildstream/pull/2089#discussion_r3404184186


##########
src/buildstream/_yaml.pyx:
##########
@@ -293,10 +293,10 @@ cpdef MappingNode load(str filename, str shortname, bint 
copy_tree=False, object
 cpdef MappingNode load_data(str data, int 
file_index=node._SYNTHETIC_FILE_INDEX, str file_name=None, bint 
copy_tree=False):
     cdef Representer rep
 
-    try:

Review Comment:
   The error reported in #1833 ("'NoneType' object is not callable") is not an 
`ImportError`, so this wouldn't help.
   
   What about something like
   ```
   try:
       rep = Representer(file_index)
       parser = yaml.CParser(data)
   except Exception as e:
       raise LoadError("YAML parser initialization failed:\n\n{}\n\n".format(e),
                          LoadErrorReason.INVALID_YAML) from e
   
   try:
       try:
           while parser.check_event():
   ...
   ```
   
   I.e., just switching to a more suitable error message. (We could also define 
a new `LoadErrorReason` if we prefer).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to