Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Flash IOError 2038 and 1000 (how?) #1008

Open
Eegee opened this issue Jan 21, 2014 · 1 comment
Open

Handle Flash IOError 2038 and 1000 (how?) #1008

Eegee opened this issue Jan 21, 2014 · 1 comment
Milestone

Comments

@Eegee
Copy link
Contributor

Eegee commented Jan 21, 2014

Hello,

I'm not quite sure if I should post this to the forum or post it here, but I think it is a feature request, so here goes...

I'm trying PLUpload 2.1(.1), but cannot seem to catch certain Flash errors. I tried a lot of debugging and adding code, but I cannot get enough grasp on the code because of my lack of experience with Flash development and moxie internals. :-o

I would like to have Flash I/O Error # 2038 and Error # 1000 (out of memory) captured by moxie, and then routed through to plupload and jquery.ui.plupload, just like plupload.HTTP_ERROR eventually gets handled to output an error message, when the receiving server isn't listening.

Error # 1000 gets thrown when clicking on the upload button, trying to chunk-upload a file that is too large for Flash to handle at that moment (for instance a 2 GB file). Then I would like to see the same error message as for IMAGE_MEMORY_ERROR, 'Runtime ran out of available memory.'. Now the file just stays in the queue, looking as if it is still processing.

Error # 2038 gets thrown after selecting a file that is larger than uint.MAX_VALUE (cq Number, 4294967295), on the following code lines:

flash.net::FileReference/get size()
at com::Blob()[D:\Users\user\Documents\GitHub\moxie\src\flash\src\com\Blob.as:62]
at com::File()[D:\Users\user\Documents\GitHub\moxie\src\flash\src\com\File.as:36]
at com::FileInput/onDialogEvent()[D:\Users\user\Documents\GitHub\moxie\src\flash\src\com\FileInput.as:150]

I think this error could be best handled in onDialogEvent, but I don't have enough experience in Flash development to implement it properly.

So I added an uncaughtErrorHandler in Moxie.as (ugly, but I had to try something) like so:

private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
{
    if (event.error is Error)
    {
        var error:Error = event.error as Error;
        _fireEvent(uid + "::Exception", { name: getQualifiedClassName(error).replace(/^[^:*]::/, ''), code: error.errorID });
    }
    else if (event.error is ErrorEvent)
    {
        var errorEvent:ErrorEvent = event.error as ErrorEvent;
        _fireEvent(uid + "::Exception", { name: getQualifiedClassName(errorEvent).replace(/^[^:*]::/, ''), code: errorEvent.errorID } );
    }
    else
    {
        // a non-Error, non-ErrorEvent type was thrown and uncaught
    }
}

and in _init, adding the line:

loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);

Then I tried capturing the exceptions in RuntimeClient.js (moxie.js), line 72, the commented line:

/*runtime.bind('Exception', function() { });*/

which probably also isn't a good idea since it is commented out...

I do get those two exceptions # 2038 and # 1000 in this anonymous function (in argument 2), but I don't know handle it further to get it passed to jquery.ui.plupload. I tried lots of trigger('Error') / RuntimeError etc, but I realise I'm kind of fooling around trying, not having enough experience.

I've used plupload 1.5.7 previously, and this could handle Flash error 2038 more how I would want it, adding an error on top of the widget.

Davit, could you please shed your light on how to handle these Flash errors? I understand this might not be an easy task, for me it sure isn't (I'm trying hard the last few days, to no avail :-/ ) but I'm hoping you have some time to investigate.

If you require more information, please say so and I will try to provide it.

Erik Jan

@jayarjo
Copy link
Contributor

jayarjo commented Jan 21, 2014

That's quite an investigation there actually. I will look into it. Thanks for your time and efforts.

@jayarjo jayarjo added this to the 2.3.3 milestone Aug 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants