无法从错误对象获取属性

时间:2015-07-22 06:59:37

标签: javascript

我正在连接到Facebook API并收到此错误

{ [Error: failed [500] {"error":{"message":"Invalid parameter","type":"FacebookApiException","code":100,"error_subcode":1349125,"is_transient":false,"error_user_title":"Missing Message Or Attachment","error_user_msg":"Missing message or attachment."}}] stack: [Getter] }

我想收到error_user_msg

    try {
      var response = Social.createPosting(graphType, data);
    } catch (exception) {
      console.log(exception)
      throw new Meteor.Error(exception.error_user_msg)
    }

问题仅在于返回的message对象上定义了Error属性。

exception.message返回

failed [500] {"error":{"message":"Invalid parameter","type":"FacebookApiException","code":100,"error_subcode":1349125,"is_transient":false,"error_user_title":"Missing Message Or Attachment","error_user_msg":"Missing message or attachment."}}

哪个是String,但是无效的JSON,所以我无法解析它

我错过了什么?

0 个答案:

没有答案