来自Node.js的更详细的错误消息BigQuery客户端库 [英] More detailed error messages from Node.js BigQuery client library

查看:156
本文介绍了来自Node.js的更详细的错误消息BigQuery客户端库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Google Node连接到BigQuery

我有以下代码将数据流记录到数据库中:

I have the following snippet to stream records into the database:

module.exports.sendToBigQuery = (rows) => {
    bigquery
        .dataset(DATASET_NAME)
        .table(TABLE_NAME)
        .insert(rows)
        .catch(err => {
            if (err && err.name === 'PartialFailureError') {
                if (err.errors && err.errors.length > 0) {
                    console.log('Insert errors:');
                    err.errors.forEach(err => console.error(err));
                }
            } else {
                console.error('ERROR:', err);
            }
        });
};

不幸的是,每当我的数据与scema不匹配时,我所得到的只是这个神秘的错误对象:
{errors:[{message:'no such field。',reason:'invalid'}],

Unfortunately, whenever my data doesn't match the scema, all I'm getting is this cryptic error object: { errors: [ { message: 'no such field.', reason: 'invalid' } ],

没有位置字段,它会告诉我哪个字段丢失,这使得调试此代码成为更复杂模式的噩梦。

There is no location field that would tell me which field is missing which makes debugging this code a nightmare for more complex schemas.

是否有任何方法可以以某种方式启用调试级别的错误?或者这只是客户端实现中的一个错误?任何想法如何获得这些信息?

Is there any way to enable debug level of errors somehow? Or it's just a bug in client implementation? Any idea how I could access this information?

推荐答案

云支持在这里,我可以看到你还提交了一个 github问题关于这个地方,它明确表示a)这与节点无关。 js客户端库,但对BigQuery API本身和b)您至少可以获取发生错误的行。无论如何,我认为目前还无法获得缺失的字段,但我提交了功能请求,您可以按照更新。

Cloud support here, I can see that you also filed a github issue about this where it was made clear that a) this is not related to the node.js client library but to the BigQuery API itself and b) you can at least get the row where the error occurs. In any case, I don't think it's in anyway possible to also get the missing field at this moment, but I filed a feature request that you can follow for updates.

这篇关于来自Node.js的更详细的错误消息BigQuery客户端库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆