Code Monkey home page Code Monkey logo

Comments (4)

veena-udayabhanu avatar veena-udayabhanu commented on August 15, 2024

All the errors that happen after we make the service call to the storage service are returned in the callback. The errors that happen before(mainly argument, invalid operation issues) are thrown.

We are fine with exposing the validation-utilities. But can you please tell us how you would avoid the exception if we exposed the validation methods?

from azure-storage-node.

paed01 avatar paed01 commented on August 15, 2024

I have a module that has azure-storage-node as a dependency and the table name is set programmatically. In version 0.2.0 the validation utilities was exposed and I used it similar to this:

var AzureStorage = require('azure-storage');

function callback(e) {
    if (!!e) {
        return console.log('error', e.message);
    }
    console.log('success');
}

var tableName = 'cache-me';

var tableService = AzureStorage.createTableService('UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1;');

AzureStorage.Validate.tableNameIsValid(tableName, function (verr) {
    if (verr) {
        return callback(verr);
    }

    tableService.createTableIfNotExists(tableName, function (err) {
        callback(err);
    });
});

In the current version I would be forced to implement it like this:

try {
    tableService.createTableIfNotExists('in-valid', function (err) {
        callback(err);
    });
} catch (verr) {
    callback(verr);
}

that, imho, kind of breaks the asynchronous pattern of node.

On the wish list it would be great if the validation returned the error in the callback. I would make a proper PR but I'm out of office and have a hard time to get the CLA signed by my employer.

from azure-storage-node.

veena-udayabhanu avatar veena-udayabhanu commented on August 15, 2024

Thank you for the detailed explanation. As I mentioned before, all the errors that happen after we make the service call to the storage service are returned in the callback. The errors that happen before(mainly argument, invalid operation issues) are thrown. This is in line with the documentation here - https://www.joyent.com/developers/node/design/errors.

We are however going to expose the validation utils in an upcoming release so you can continue using your code. Thanks!

from azure-storage-node.

veena-udayabhanu avatar veena-udayabhanu commented on August 15, 2024

We have fixed this in our latest release (0.3.1). Please upgrade to the latest.

from azure-storage-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.