Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-812

Throw relevant error message when Scopes and Collections are NOT Supported

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 3.1.0
    • None
    • None
    • None
    • 1
    • Critical

    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);
         }
      })
       
       
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brett19 Brett Lawson
            arun.vijayraghavan Arun Vijayraghavan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty