This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 75c711f  Added some diagnostic logging for debug builds in AMF 
deserialization. This can help with interpreting reasons for some remoting 
Faults
75c711f is described below

commit 75c711f85a8c4f2fc771a204f9725e7105a7f4da
Author: greg-dove <[email protected]>
AuthorDate: Fri Feb 14 22:46:36 2020 +1300

    Added some diagnostic logging for debug builds in AMF deserialization. This 
can help with interpreting reasons for some remoting Faults
---
 .../org/apache/royale/net/remoting/amf/AMFBinaryData.as   | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/remoting/amf/AMFBinaryData.as
 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/remoting/amf/AMFBinaryData.as
index 47a07ff..d9fe43c 100644
--- 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/remoting/amf/AMFBinaryData.as
+++ 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/remoting/amf/AMFBinaryData.as
@@ -23,6 +23,10 @@ package org.apache.royale.net.remoting.amf {
        import org.apache.royale.utils.net.IDynamicPropertyWriter;
        import org.apache.royale.utils.net.IExternalizable;
        import org.apache.royale.utils.BinaryData;
+
+       COMPILE::JS{
+               import goog.DEBUG;
+       }
        
        COMPILE::SWF{
                import flash.net.ObjectEncoding;
@@ -115,6 +119,9 @@ package org.apache.royale.net.remoting.amf {
                        var value:* = 
_serializationContext.readObjectExternal();
                        var err:Error = _serializationContext.getError();
                        if (err) {
+                               if (goog.DEBUG){
+                                       
console.log('%c[AMFBinaryData.readObject] - Deserialization Error :'+ 
err.message,'color:red');
+                               }
                                throw new Error(err.message);
                        }
                        return value;
@@ -1217,7 +1224,13 @@ class SerializationContext extends BinaryData  
implements IDataInput, IDataOutpu
                                try {
                                        value = readScriptObject();
                                } catch (e:Error) {
-                                       throw new Error("Failed to deserialize: 
" + e);
+                                       if (goog.DEBUG){
+                                               var err:Error = 
(e.message.indexOf("Failed to deserialize") == -1)
+                                                               ? new 
Error("Failed to deserialize: " + e.message +' '+e.stack.split('\n')[1])
+                                                               : e;
+                                               throw err;
+                                       }
+                                       else throw new Error("Failed to 
deserialize: " + e.message);
                                }
                                break;
                        case AMF3_ARRAY:

Reply via email to