google-cloud-bucket
Advanced tools
Comparing version 0.14.2 to 0.14.3
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.14.3"></a> | ||
## [0.14.3](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.14.2...v0.14.3) (2019-04-23) | ||
### Features | ||
* Add better error handling for bucket creation ([b16fc47](https://github.com/nicolasdao/google-cloud-bucket/commit/b16fc47)) | ||
<a name="0.14.2"></a> | ||
@@ -7,0 +17,0 @@ ## [0.14.2](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.14.1...v0.14.2) (2019-04-22) |
14
index.js
@@ -209,3 +209,15 @@ /** | ||
const createBucket = (bucket, options={}) => _getToken(options.token).then(token => gcp.bucket.create(bucket, projectId, token, options)).then(({ data }) => data) | ||
const createBucket = (bucket, options={}) => _getToken(options.token).then(token => gcp.bucket.create(bucket, projectId, token, options)).then(({ status, data }) => { | ||
if (status > 299) { | ||
let errMsg | ||
try { | ||
errMsg = JSON.stringify(data) | ||
} catch(e) { | ||
(() => errMsg=`${data}`)(e) | ||
} | ||
throw new Error(`Failed to create bucket. Details: ${errMsg}`) | ||
} | ||
return data | ||
}) | ||
const deleteBucket = (bucket, options={}) => _getToken(options.token).then(token => _retryFn(() => gcp.bucket.delete(bucket, token))).then(({ status, data }) => { | ||
@@ -212,0 +224,0 @@ let d = data |
{ | ||
"name": "google-cloud-bucket", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"description": "Nodejs package to add objects to a Google Cloud Bucket.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ # Google Cloud Bucket · [![NPM](https://img.shields.io/npm/v/google-cloud-bucket.svg?style=flat)](https://www.npmjs.com/package/google-cloud-bucket) [![Tests](https://travis-ci.org/nicolasdao/google-cloud-bucket.svg?branch=master)](https://travis-ci.org/nicolasdao/google-cloud-bucket) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Neap](https://neap.co/img/made_by_neap.svg)](#this-is-what-we-re-up-to) | ||
> - [Basics](#basics) | ||
> - [Configuring Your Bucket Or Your File (CORS, Public, Website)](#configuring-your-bucket-or-your-file) | ||
> - [Configuring Your Bucket Or Your File (CORS, Public, Static Website)](#configuring-your-bucket-or-your-file) | ||
> - [Zipping Files](#zipping-files) | ||
@@ -13,0 +13,0 @@ > - [3 Ways To Create a Client](#3-ways-to-create-a-client) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123658
1718