Throw relevant error message when Scopes and Collections are NOT Supported

Description

What was Done :   We attempted to create collection using Node.js SDK (latest) and Legacy Database. (Database which doesnt have a support for Scopes and Collections) 

 

What is Expected :  Error something like   “ Unsupported Feature Exception ” .

 

What was Observed :  Error: failed to create collection   

 

Problem Statement  :  What is currently thrown is a more generic exception “failed to create collection” which is very much likely to happen in 7.0. for various reason. There needs to be a more specific error message returned back to the developer so that they can make better decisions. Needed in situations like Ottoman to determine the next course of action.

 

Below is code that we used.

 

 

const couchbase = require("couchbase"); const CollectionExistsError = require("couchbase").CollectionExistsError const cluster = new couchbase.Cluster("couchbase://localhost", {       username: "Administrator",       password: "password", })   // Open a bucket to allow cluster-level querying var bucket = cluster.bucket('travel') // var collection = bucket.collection('Airline') const createCollection = async () => { try {    await bucket.collections().createCollection({    name: 'Airlinez',    scopeName: '_default',    maxExpiry: 500,  }) } catch(e) {    console.error(e.message) }}   createCollection() .catch((e) => {    if (!(e instanceof CollectionExistsError)) {         console.error(e);   } })

 

Environment

None

Gerrit Reviews

None

Release Notes Description

None

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

CVSS/Severity

Critical

Story Points

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created November 21, 2020 at 12:08 AM
Updated December 1, 2020 at 8:45 PM
Resolved December 1, 2020 at 8:45 PM
Instabug