1
的條紋API將返回我JSON字典(無論是)時,條紋的OAuth過程失敗返回。我將它作爲變量存儲,但我無法訪問它的值「error_description」。 Here is a link to the relevant Stripe docs訪問值從條紋API流星
不知道是否有差別,但是這是在服務器端方法的流星應用。
我有以下的存儲爲所謂的「錯誤」變量。這是我的console.log(錯誤);
{ [Error: failed [400] { "error": "invalid_grant", "error_description": "Authorization code does not exist: ac_7z4pnJ8ee71yJNxguV6wiINIf10fgl6j" }] stack: [Getter] }
我的問題是:如何訪問「error_description」?
它似乎並不當我寫
var newError = error.error_description
工作,如果任何人都可以幫我把ERROR_DESCRIPTION這將是真棒,謝謝!
更新 添加.message刪除響應的一部分,但我仍然無法JSON.parse,或訪問ERROR_DESCRIPTION
VAR誤差=返回Error.message結果
failed [400] { "error": "invalid_grant", "error_description": "Authorization code does not exist: ac_7z4pnJ8ee71yJNxguV6wiINIf10fgl6j" }
感謝您的回覆。當我這樣做,我得到這個錯誤: 「異常而調用方法‘stripeAuth’語法錯誤:意外的令牌é I20160227-12:34:12.414(0)?在Object.parse(native) I20160227-12:34:12.414(0)?在[對象的對象] .Meteor.methods.stripeAuth(服務器/條紋/方法/條紋連接-authenticate.js:18:20)」 – Sean
還有更多,但我認爲前3行告訴故事 – Sean
謝謝,仍然不相當有效,但確實改變了一些事情。更新我原來的問題在底部,所以你可以在Object.parse 看 – Sean