How to use the dropbox.ApiError function in dropbox

To help you get started, we’ve selected a few dropbox 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 filefog / filefog / old / dropbox / dropbox_client.js View on Github external
var FFTokenRejected = errorTypes.FFTokenRejected;
                    return new FFTokenRejected('User token has expired');

                case Dropbox.ApiError.NOT_FOUND:
                    // The file or folder you tried to access is not in the user's Dropbox.
                    // Handling this error is specific to your application.
                    var FFItemDoesNotExist = errorTypes.FFItemDoesNotExist;
                    return new FFItemDoesNotExist();

                case Dropbox.ApiError.OVER_QUOTA:
                    // The user is over their Dropbox quota.
                    // Tell them their Dropbox is full. Refreshing the page won't help.
                    var FFOverQuota = errorTypes.FFOverQuota
                    return new FFOverQuota();

                case Dropbox.ApiError.RATE_LIMITED:
                    // Too many API requests. Tell the user to try again later.
                    // Long-term, optimize your code to use fewer API calls.
                    var FFRateLimit = errorTypes.FFRateLimit;
                    return new FFRateLimit();

                case Dropbox.ApiError.NETWORK_ERROR:
                    // An error occurred at the XMLHttpRequest layer.
                    // Most likely, the user's network connection is down.
                    // API calls will not succeed until the user gets back online.
                    return error;

                case Dropbox.ApiError.INVALID_PARAM:
                    var FFParameterRejected = errorTypes.FFParameterRejected
                    return new FFParameterRejected();
                case Dropbox.ApiError.OAUTH_ERROR:
                    var FFTokenRejected = errorTypes.FFTokenRejected
github keeweb / keeweb / app / scripts / comp / dropbox-link.js View on Github external
Alerts.yesno({
                        icon: 'dropbox',
                        header: Locale.dropboxLogin,
                        body: Locale.dropboxLoginBody,
                        buttons: [{result: 'yes', title: Locale.alertSignIn}, {result: '', title: Locale.alertCancel}],
                        success: () => {
                            this.authenticate(err => { callback(!err); });
                        },
                        cancel: () => {
                            callback(false);
                        }
                    });
                    return;
                }
                break;
            case Dropbox.ApiError.NOT_FOUND:
                alertCallback({
                    header: Locale.dropboxSyncError,
                    body: Locale.dropboxNotFoundBody
                });
                break;
            case Dropbox.ApiError.OVER_QUOTA:
                alertCallback({
                    header: Locale.dropboxFull,
                    body: Locale.dropboxFullBody
                });
                break;
            case Dropbox.ApiError.RATE_LIMITED:
                alertCallback({
                    header: Locale.dropboxSyncError,
                    body: Locale.dropboxRateLimitedBody
                });
github keeweb / keeweb / app / scripts / comp / dropbox-link.js View on Github external
};

DropboxChooser.prototype.readFile = function(url) {
    const xhr = new XMLHttpRequest();
    xhr.addEventListener('load', () => {
        this.callback(null, { name: this.result.name, data: xhr.response });
    });
    xhr.addEventListener('error', this.callback.bind(this, 'download error'));
    xhr.addEventListener('abort', this.callback.bind(this, 'download abort'));
    xhr.open('GET', url);
    xhr.responseType = 'arraybuffer';
    xhr.send();
};

const DropboxLink = {
    ERROR_CONFLICT: Dropbox.ApiError.CONFLICT,
    ERROR_NOT_FOUND: Dropbox.ApiError.NOT_FOUND,

    Keys: DropboxKeys,

    _getClient: function(complete, overrideAppKey) {
        if (this._dropboxClient && this._dropboxClient.isAuthenticated()) {
            complete(null, this._dropboxClient);
            return;
        }
        if (!overrideAppKey && !this.isValidKey()) {
            return complete(DropboxCustomErrors.BadKey);
        }
        const client = new Dropbox.Client({key: overrideAppKey || getKey()});
        if (Launcher) {
            client.authDriver(new Dropbox.AuthDriver.Electron({ receiverUrl: location.href }));
        } else {
github enyojs / ares-project / hermes / fsDropbox.js View on Github external
FsDropbox.prototype.errorResponse = function(err) {
	this.log("FsDropbox.errorResponse(): err:", err);
	var response;
	if (err instanceof dropbox.ApiError) {
		response = {
			code: err.status,
			body: err.response
		};
		this.log(err.stack);
	} else {
		response = FsBase.prototype.errorResponse.bind(this)(err);
	}
	this.log("FsDropbox.errorResponse(): response:", response);
	return response;
};

dropbox

The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis