Skip to content

Commit

Permalink
give a warning when jdatadecode fails, but still return the raw data
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Feb 10, 2022
1 parent 05edb7a commit 88a59eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion loadbj.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@
end

if(jsonopt('JDataDecode',1,varargin{:})==1)
data=jdatadecode(data,'Base64',0,'Recursive',1,varargin{:});
try
data=jdatadecode(data,'Base64',0,'Recursive',1,varargin{:});
catch ME
warning(['Failed to decode embedded JData annotations, '...
'return raw JSON data\n\nError: %s\n%s'], ME.identifier, ME.message);
end
end
end

Expand Down
7 changes: 6 additions & 1 deletion loadjson.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@
end

if(jsonopt('JDataDecode',1,varargin{:})==1)
data=jdatadecode(data,'Base64',1,'Recursive',1,varargin{:});
try
data=jdatadecode(data,'Base64',1,'Recursive',1,varargin{:});
catch ME
warning(['Failed to decode embedded JData annotations, '...
'return raw JSON data\n\nError: %s\n%s'], ME.identifier, ME.message);
end
end

if(isfield(opt,'progressbar_'))
Expand Down

0 comments on commit 88a59eb

Please sign in to comment.