0
目前我使用Node.js連接到Nest Thermostat API。目前,我的應用程序中的所有內容除了獲取詳細的錯誤消息外都適用如何從Nest Firebase API獲取更詳細的錯誤消息?
每當我想在結構的變化我定義爲在火力地堡(_fb
)一_sendUpdate
電話:
FireBaseRef.prototype._sendUpdate = function(path, targetValue, callback) {
log.i('set ' + path + ' (' + targetValue + ')');
this._fb.child(path).set(targetValue, function(error {
log.e(JSON.stringify(error));
});
}
它使用Firebase.set()
功能。出現錯誤時,此回調會傳遞一個錯誤對象,否則如here所述的null
。
作爲示例錯誤,我們嘗試設置Nest恆溫器設置爲離開時的溫度。按照Nest API guide,類似於以下的錯誤信息應該被看作
{
"error": "Cannot change target temperature while structure is Away",
"type": "https://developers.nest.com/documentation/cloud/error-messages#structure-in-away-mode",
"message": "Cannot change target temperature while structure is Away",
"instance": "31441a94-ed26-11e4-90ec-1681e6b88ec1",
}
但是,相反,我只是得到一個火力地堡警告:
FIREBASE WARNING: set at /devices/thermostats/-GEIJToEG3M9p_jic4J9u7vAgh/target_temperature_c failed: Cannot change target temperature while structure is away
和我的日誌記錄探測到類似的detailless錯誤:
{
"code":"CANNOT CHANGE TARGET TEMPERATURE WHILE STRUCTURE IS AWAY"
}
任何人都可以解釋我可以如何獲得更詳細的錯誤信息?
注:我使用火力地堡API 2.4.2自V3帶有驗證錯誤,所以我使出版本中的示例代碼中使用(here)