3 Replies Latest reply on Sep 18, 2013 9:37 AM by webysther

    Trap File I/O Error

    sleblang Level 1

      I am getting the following error:

       

      Error #2044: Unhandled IOErrorEvent:. text=Error #3003: File or directory does not exist.

       

      How can I trap this error? I have tried using a Try/Catch as well as a listener - see code below:

       

      try {
       var sourceFile:File = new File();
       sourceFile.addEventListener(IOErrorEvent.IO_ERROR,onSourceFileIoError);
       sourceFile = File.desktopDirectory.resolvePath( model.networkDriveLetter + "\\" + event.payload.asset_location );
      }
      catch(e:Error){trace('an error has occurred')};
      

       

       

      However, neither of these seems to trap the error. Suggestions?

       

      Thanks, in advance.

        • 1. Re: Trap File I/O Error
          sleblang Level 1

          ....bump.

           

          Thanks.

          • 2. Re: Trap File I/O Error
            kraikit Level 2

            Are you sure the error is coming from that block of code? From my understanding, File.resolvePath() does not throw an error if the path does not exist. You can test this out by adding a trace line after the resolvePath() call, e.g.

             

                            try {

                                var sourceFile:File = new File();

                                sourceFile.addEventListener(IOErrorEvent.IO_ERROR,onSourceFileIoError);

                                sourceFile = File.desktopDirectory.resolvePath( model.networkDriveLetter + "\\" + event.payload.asset_location );

                                trace("file exists? " + sourceFile.exists);

                            }

                            catch(e:Error){trace('an error has occurred')};

             

            -- Tom

            Flex SDK enginner

            • 3. Re: Trap File I/O Error
              webysther

              Hi Tom, this is a problema of File. This error don't block execution in debug mode.

               

              Error #2044: Unhandled IOErrorEvent:. text=Error #3003: File or directory does not exist.

                        at flash.filesystem::File/resolveComponents()

                        at flash.filesystem::File/resolvePath()