How to use the @google-cloud/common.util.PartialFailureError function in @google-cloud/common

To help you get started, we’ve selected a few @google-cloud/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-bigquery / src / table.ts View on Github external
const partialFailures = (resp.insertErrors || []).map((
          insertError
        ) => {
          return {
            errors: insertError.errors.map((error) => {
              return {
                message: error.message,
                reason: error.reason,
              };
            }),
            row: rows[insertError.index],
          };
        });

        if (partialFailures.length > 0) {
          err = new util.PartialFailureError({
            errors: partialFailures,
            response: resp,
          } as any);
        }

        callback(err, resp);
      }
    );