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

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: Misc fixes 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 {
Bob Nystrom 2012/11/16 19:53:30 extends Exception Or implements?
nweiz 2012/11/17 01:06:27 Done.
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. This is optional.
Bob Nystrom 2012/11/16 19:53:30 Will it be `null` or `""` if not provided?
nweiz 2012/11/17 01:06:27 null. Made this clear in the docs.
17 final String description;
18
19 /// A URI for a page that describes the error in more detail, provided by the
20 /// server. This is optional.
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.';
Bob Nystrom 2012/11/16 19:53:30 I think I'd prefer to rely on the description havi
nweiz 2012/11/17 01:06:27 I haven't actually seen any OAuth2 providers that
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698