forked from esconie/dropbox-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
298 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Information about an OAuth 2.0 error returned from the Dropbox API. | ||
class Dropbox.AuthError | ||
# @property {String} one of the {Dropbox.AuthError} constants. | ||
# | ||
# @see http://tools.ietf.org/html/rfc6749 | ||
code: null | ||
|
||
# @property {?String} developer-friendly explanation of the error | ||
description: null | ||
|
||
# @property {?String} URL to a developer-friendly page | ||
uri: null | ||
|
||
# Error code indicating the user did not authorize the application. | ||
# | ||
# This error is reported when a user clicks the 'Deny' button on the | ||
# Authorization dialog. | ||
@ACCESS_DENIED: 'access_denied' | ||
|
||
# Error code indicating a malformed OAuth request. | ||
# | ||
# This indicates a bug in dropbx.js and should never occur under normal | ||
# circumstanes. | ||
@INVALID_REQUEST: 'invalid_request' | ||
|
||
# Error code indicating that the client is not allowed to use a OAuth method. | ||
# | ||
# This is most likely due to an error in the application's configuration. | ||
# @see https://www.dropbox.com/developers/apps | ||
@UNAUTHORIZED_CLIENT: 'unauthorized_client' | ||
|
||
# Error code indicating an invalid or already-used authorization code. | ||
# | ||
# This indicates a bug in dropbox.js and should never occur under normal | ||
# circumstances. A faulty OAuth driver might cause this error. | ||
@INVALID_GRANT: 'invalid_grant' | ||
|
||
# Error code indicating an invalid scope parameter. | ||
# | ||
# This version of dropbox.js does not use OAuth 2.0 scopes, so this error | ||
# indicates a bug in the library, or that the library must be updated. | ||
@INVALID_SCOPE: 'invalid_scope' | ||
|
||
# Error code indicating an un-implemented or invalid authorization method. | ||
# | ||
# This indicates a bug in dropbox.js and should never occur under normal | ||
# circumstances. | ||
@UNSUPPORTED_GRANT_TYPE: 'unsupported_grant_type' | ||
|
||
# Error code indicating an un-implemented or invalid authorization method. | ||
# | ||
# This indicates a bug in dropbox.js and should never occur under normal | ||
# circumstances. | ||
@UNSUPPORTED_RESPONSE_TYPE: 'unsupported_response_type' | ||
|
||
# The OAuth 2.0 equivalent of a HTTP 500 error code. | ||
# | ||
# This indicates a bug in the Dropbox API server. The application and/or | ||
# dropbox.js will have to be modified to work around the bug. | ||
@SERVER_ERROR: 'server_error' | ||
|
||
# The OAuth 2.0 equivalent of a HTTP 503 error code. | ||
# | ||
# This occurrs when the application is rate-limited. | ||
@TEMPORARILY_UNAVAILABLE: 'temporarily_unavailable' | ||
|
||
# Wraps an XHR error. | ||
# | ||
# @param {Object} queryString a parsed response from the /authorize or /token | ||
# OAuth 2.0 endpoints | ||
# @throw {Error} if queryString does not represent an OAuth 2.0 error | ||
# response | ||
constructor: (queryString) -> | ||
unless queryString.error | ||
throw new Error("Not an OAuth 2.0 error: #{JSON.stringify(queryString)}") | ||
|
||
if typeof queryString.error is 'object' and queryString.error.error | ||
# The API server sometimes returns the OAuth 2.0 error information | ||
# wrapped in an 'error' object. | ||
root = queryString.error | ||
else | ||
root = queryString | ||
@code = root.error | ||
@description = root.error_description or null | ||
@uri = root.error_uri or null | ||
|
||
# Developer-friendly summary of the error. | ||
toString: -> | ||
"Dropbox OAuth error #{@code} :: #{@description}" | ||
|
||
# Used by some testing frameworks. | ||
inspect: -> | ||
@toString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.