1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tokenserver/TokenServerException.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.tokenserver; 1.9 + 1.10 +import java.util.List; 1.11 + 1.12 +import org.mozilla.gecko.sync.ExtendedJSONObject; 1.13 + 1.14 +public class TokenServerException extends Exception { 1.15 + private static final long serialVersionUID = 7185692034925819696L; 1.16 + 1.17 + public final List<ExtendedJSONObject> errors; 1.18 + 1.19 + public TokenServerException(List<ExtendedJSONObject> errors) { 1.20 + super(); 1.21 + this.errors = errors; 1.22 + } 1.23 + 1.24 + public TokenServerException(List<ExtendedJSONObject> errors, String string) { 1.25 + super(string); 1.26 + this.errors = errors; 1.27 + } 1.28 + 1.29 + public TokenServerException(List<ExtendedJSONObject> errors, Throwable e) { 1.30 + super(e); 1.31 + this.errors = errors; 1.32 + } 1.33 + 1.34 + public static class TokenServerConditionsRequiredException extends TokenServerException { 1.35 + private static final long serialVersionUID = 7578072663150608399L; 1.36 + 1.37 + public final ExtendedJSONObject conditionUrls; 1.38 + 1.39 + public TokenServerConditionsRequiredException(ExtendedJSONObject urls) { 1.40 + super(null); 1.41 + this.conditionUrls = urls; 1.42 + } 1.43 + } 1.44 + 1.45 + public static class TokenServerInvalidCredentialsException extends TokenServerException { 1.46 + private static final long serialVersionUID = 7578072663150608398L; 1.47 + 1.48 + public TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors) { 1.49 + super(errors); 1.50 + } 1.51 + 1.52 + public TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors, String message) { 1.53 + super(errors, message); 1.54 + } 1.55 + } 1.56 + 1.57 + public static class TokenServerUnknownServiceException extends TokenServerException { 1.58 + private static final long serialVersionUID = 7578072663150608397L; 1.59 + 1.60 + public TokenServerUnknownServiceException(List<ExtendedJSONObject> errors) { 1.61 + super(errors); 1.62 + } 1.63 + 1.64 + public TokenServerUnknownServiceException(List<ExtendedJSONObject> errors, String message) { 1.65 + super(errors, message); 1.66 + } 1.67 + } 1.68 + 1.69 + public static class TokenServerMalformedRequestException extends TokenServerException { 1.70 + private static final long serialVersionUID = 7578072663150608396L; 1.71 + 1.72 + public TokenServerMalformedRequestException(List<ExtendedJSONObject> errors) { 1.73 + super(errors); 1.74 + } 1.75 + 1.76 + public TokenServerMalformedRequestException(List<ExtendedJSONObject> errors, String message) { 1.77 + super(errors, message); 1.78 + } 1.79 + } 1.80 + 1.81 + public static class TokenServerMalformedResponseException extends TokenServerException { 1.82 + private static final long serialVersionUID = 7578072663150608395L; 1.83 + 1.84 + public TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, String message) { 1.85 + super(errors, message); 1.86 + } 1.87 + 1.88 + public TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, Throwable e) { 1.89 + super(errors, e); 1.90 + } 1.91 + } 1.92 +}