2017-10-31 7 views
1

私はhttps://developers.google.com/datastudio/connector/error-handling#non-admin-messagesのガイドに従って、getDataメソッドからユーザーにエラーを返すようにしました。ユーザーにエラーをスローするように提供される例の方法を用いた場合でもしかし、私はまだ私のすべてのレポートで、一般的なエラーを取得する:コミュニティコネクタからユーザーにエラーを投げる

ロギング方法:

/** 
    * Throws an error that complies with the community connector spec. 
    * @param {string} message The error message. 
    * @param {boolean} userSafe Determines whether this message is safe to show 
    *  to non-admin users of the connector. true to show the message, false 
    *  otherwise. false by default. 
    */ 
    function throwConnectorError(message, userSafe) { 
    userSafe = (typeof userSafe !== 'undefined' && 
       typeof userSafe === 'boolean') ? userSafe : false; 
    if (userSafe) { 
     message = 'DS_USER:' + message; 
    } 

    throw new Error(message); 
    } 

電話番号:

try{ 
    //SOME CODE HERE THAT THROWS ERROR 
}catch (ex){ 
    logConnectorError("getData: Unexpected Error:", ex); 
    if (ex.message !== null){  
     throwConnectorError("Unable to fetch data due to server error: " + ex.message, true); 
    } 
    else{ 
     throwConnectorError("Unexpected error: " + ex, true); 
    } 
    } 
ランニング

エラー:

Error Details 
The server encountered an internal error and was unable to complete your request. 
Error ID: 0e1e80fb 

は、このシステムがまだ働いているか、eがありますxample working connector私は何かが欠落しているかどうかを見ることができますか?

答えて

0

エラー処理の例については、npm Downloads ConnectorStack Overflow Questions Connectorなどのオープンソースコミュニティコネクタをご覧ください。エラーメッセージが表示されない限り、isAdminUser()関数がテスター用にtrueを返すことを確認してください。エラー処理は、主にgetData()に対応しています。今のところ、他の必要な機能ではうまく動作しないことがあります。

関連する問題