Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: pkg/oauth2/lib/src/authorization_exception.dart

Issue 11420025: Add a package for authenticating via OAuth2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library authorization_exception;
6
7 import 'dart:io';
8
9 /// An exception raised when OAuth2 authorization fails.
10 class AuthorizationException implements Exception {
11 /// The name of the error. Possible names are enumerated in [the spec][].
12 ///
13 /// [the spec]: http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-5.2
14 final String error;
15
16 /// The description of the error, provided by the server. Defaults to null.
17 final String description;
18
19 /// A URI for a page that describes the error in more detail, provided by the
20 /// server. Defaults to null.
21 final Uri uri;
22
23 /// Creates an AuthorizationException.
24 AuthorizationException(this.error, this.description, this.uri);
25
26 /// Provides a string description of the AuthorizationException.
27 String toString() {
28 var header = 'OAuth authorization error ($error)';
29 if (description != null) {
30 header = '$header: $description';
31 } else if (uri != null) {
32 header = '$header: $uri';
33 }
34 return '$header.';
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698