Mycroft.Messages.App.AppManifestFail.Deserialize C# (CSharp) Method

Deserialize() public static method

public static Deserialize ( string json ) : DataPacket
json string
return DataPacket
        public static new DataPacket Deserialize(string json)
        {
            try
            {
                var ret = new AppManifestFail();
                var obj = Json.Decode(json);
                ret.Message = obj["message"];
                if (ret.Message == null)
                {
                    throw new ParseException(json, "Did not contain 'message'");
                }
                return ret;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException)
            {
                // NOTE: this probably should never be caught because obj["foo"], when foo doesn't exist,
                // just returns null and doesnt throw an exception. But I'm keeping this just in case.
                throw new ParseException(json, "Did not contain 'message'");
            }
            catch (ArgumentException)
            {
                throw new ParseException(json, "Invalid JSON");
            }
        }