can't get errors...

craouettecraouette Posts: 113

Hi,

I can't find the way to get errors...
I open a graph both in my canvas editor and in canvas.py
I edit one of the function preset (getRootTransform) and type in bad text (a = a + b; where a and b are not defined.
When I hit go up in canvas, I got 'a' symbol not found.
In my own implementation, I call:

   FabricCore::String str = exec.getLoadDiags();
    const char *jsonStr = str.getCString();
    FabricCore::String eStr = exec.getErrors(true);
    const char *errStr = eStr.getCString();

with exec coming from

FabricCore::DFGExec exec = binding.getExec();

or

  FabricCore::DFGExec exec = binding.getExec();

  exec = exec.getSubExec(currentGraphPath);

the 2 returned string are "[]" in both cases....

so, How can I get the errors?

thanks,

Pierre

Comments

  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @craouette

    We are handling the errors in the following way. See how we also include a call to binding.hasRecursiveConnectedErrors() which might explain the different results you are getting

      FabricCore::DFGBinding binding = m_dfgController->getBinding();
      bool bindingHasRecursiveConnectedErrors = binding.hasRecursiveConnectedErrors(); // updates errors by side effect
    
      int firstErrorRow = 0;
      switch ( m_focus )
      {
        case Focus_Exec:
        {
          FabricCore::DFGExec exec = m_dfgController->getExec();
          FabricCore::String errorsJSON = exec.getErrors( true /* recursive */ );
          FTL::StrRef errorsJSONStr( errorsJSON.getCStr(), errorsJSON.getLength() );
          FTL::JSONStrWithLoc errorsJSONStrWithLoc( errorsJSONStr );
          m_errors = 
            FTL::JSONValue::Decode( errorsJSONStrWithLoc )->cast<FTL::JSONArray>();
        }
        break;
    
        case Focus_Binding:
        {
          FabricCore::String loadDiagsJSON = binding.getLoadDiags();
          FTL::StrRef loadDiagsJSONStr( loadDiagsJSON.getCStr(), loadDiagsJSON.getLength() );
          FTL::JSONStrWithLoc loadDiagsJSONStrWithLoc( loadDiagsJSONStr );
          m_errors = 
            FTL::JSONValue::Decode( loadDiagsJSONStrWithLoc )->cast<FTL::JSONArray>();
          firstErrorRow = m_errors->size();
    
          if ( bindingHasRecursiveConnectedErrors )
          {
            FabricCore::String errorsJSON =
              binding.getErrors( true /* recursive */ );
            FTL::StrRef errorsJSONStr( errorsJSON.getCStr(), errorsJSON.getLength() );
            FTL::JSONStrWithLoc errorsJSONStrWithLoc( errorsJSONStr );
            FTL::OwnedPtr<FTL::JSONArray> errors(
              FTL::JSONValue::Decode( errorsJSONStrWithLoc )->cast<FTL::JSONArray>()
              );
            m_errors->extend_take( errors );
          }
        }
        break;
      }
    

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • craouettecraouette Posts: 113

    exec.getErrors( true /* recursive */ );
    returns [] (both on the root exec and the node with error exec).
    whereas
    binding.getErrors( true /* recursive */ );
    returns the error but with an empty execPath (in the returned json item), so the user has no way to know where the error really is!!!

    strange... but I got it to work!

    thanks @borja

Sign In or Register to comment.