You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/23 07:27:57 UTC
[royale-asjs] branch develop updated: Firefox and IE11 can give
error on JSON.parse(), so better to try-catch in order to see more info.
This is an automated email from the ASF dual-hosted git repository.
carlosrovira 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 14e1d68 Firefox and IE11 can give error on JSON.parse(),so better to try-catch in order to see more info.
14e1d68 is described below
commit 14e1d68e1d4aa2f5d169cfca5d118752afe7dc7d
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Sep 23 09:27:50 2018 +0200
Firefox and IE11 can give error on JSON.parse(),so better to try-catch in order to see more info.
---
.../src/main/royale/org/apache/royale/net/HTTPService.as | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
index 3b88efa..dab6700 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
@@ -741,7 +741,17 @@ package org.apache.royale.net
{
assert(data,"data must exist before calling json getter!");
if (!_json)
- _json = JSON.parse(data);
+ {
+ try
+ {
+ _json = JSON.parse(data);
+ }
+ catch (error:Error)
+ {
+ throw new Error ("JSON is not valid: " + data);
+ }
+
+ }
return _json;
}