[vtkusers] vtkXMLWriter: How can I catch write errors?

Mike Taverne mtaverne at engits.com
Mon May 25 10:32:27 EDT 2009


Thanks, it works.
How can I get the error text too?

Utkarsh Ayachit wrote:
> Writers typically set the ErrorCode on error. Check the value returned
> by GetErrorCode() for errors and details about the errors.
>
> Utkarsh
>
> On Mon, May 25, 2009 at 10:01 AM, Mike Taverne <mtaverne at engits.com
> <mailto:mtaverne at engits.com>> wrote:
>
>     Hi,
>
>     I'm using vtkXMLUnstructuredGridWriter and noticed that when I
>     call the "Write" method, it always returns 1, even if writing to
>     the file failed because of permission problems or a non-existent path.
>     An error code does show up in the terminal, but how can I catch it
>     in my code?
>
>     Here's the Write method, which seems to only return 0 when no
>     input is provided:
>     ================
>     int vtkXMLWriter::Write()
>     {
>      // Make sure we have input.
>      if (this->GetNumberOfInputConnections(0) < 1)
>        {
>        vtkErrorMacro("No input provided!");
>        return 0;
>        }
>
>      // always write even if the data hasn't changed
>      this->Modified();
>
>      this->Update();
>      return 1;
>
>     }
>
>     ================
>
>
>     _______________________________________________
>     Powered by www.kitware.com <http://www.kitware.com>
>
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
>
>     Please keep messages on-topic and check the VTK FAQ at:
>     http://www.vtk.org/Wiki/VTK_FAQ
>
>     Follow this link to subscribe/unsubscribe:
>     http://www.vtk.org/mailman/listinfo/vtkusers
>
>




More information about the vtkusers mailing list