1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 package org.mozilla.gecko.tokenserver; 6 7 import java.util.List; 8 9 import org.mozilla.gecko.sync.ExtendedJSONObject; 10 11 public class TokenServerException extends Exception { 12 private static final long serialVersionUID = 7185692034925819696L; 13 14 public final List<ExtendedJSONObject> errors; 15 TokenServerException(List<ExtendedJSONObject> errors)16 public TokenServerException(List<ExtendedJSONObject> errors) { 17 super(); 18 this.errors = errors; 19 } 20 TokenServerException(List<ExtendedJSONObject> errors, String string)21 public TokenServerException(List<ExtendedJSONObject> errors, String string) { 22 super(string); 23 this.errors = errors; 24 } 25 TokenServerException(List<ExtendedJSONObject> errors, Throwable e)26 public TokenServerException(List<ExtendedJSONObject> errors, Throwable e) { 27 super(e); 28 this.errors = errors; 29 } 30 31 public static class TokenServerConditionsRequiredException extends TokenServerException { 32 private static final long serialVersionUID = 7578072663150608399L; 33 34 public final ExtendedJSONObject conditionUrls; 35 TokenServerConditionsRequiredException(ExtendedJSONObject urls)36 public TokenServerConditionsRequiredException(ExtendedJSONObject urls) { 37 super(null); 38 this.conditionUrls = urls; 39 } 40 } 41 42 public static class TokenServerInvalidCredentialsException extends TokenServerException { 43 private static final long serialVersionUID = 7578072663150608398L; 44 TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors)45 public TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors) { 46 super(errors); 47 } 48 TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors, String message)49 public TokenServerInvalidCredentialsException(List<ExtendedJSONObject> errors, String message) { 50 super(errors, message); 51 } 52 } 53 54 public static class TokenServerUnknownServiceException extends TokenServerException { 55 private static final long serialVersionUID = 7578072663150608397L; 56 TokenServerUnknownServiceException(List<ExtendedJSONObject> errors)57 public TokenServerUnknownServiceException(List<ExtendedJSONObject> errors) { 58 super(errors); 59 } 60 TokenServerUnknownServiceException(List<ExtendedJSONObject> errors, String message)61 public TokenServerUnknownServiceException(List<ExtendedJSONObject> errors, String message) { 62 super(errors, message); 63 } 64 } 65 66 public static class TokenServerMalformedRequestException extends TokenServerException { 67 private static final long serialVersionUID = 7578072663150608396L; 68 TokenServerMalformedRequestException(List<ExtendedJSONObject> errors)69 public TokenServerMalformedRequestException(List<ExtendedJSONObject> errors) { 70 super(errors); 71 } 72 TokenServerMalformedRequestException(List<ExtendedJSONObject> errors, String message)73 public TokenServerMalformedRequestException(List<ExtendedJSONObject> errors, String message) { 74 super(errors, message); 75 } 76 } 77 78 public static class TokenServerMalformedResponseException extends TokenServerException { 79 private static final long serialVersionUID = 7578072663150608395L; 80 TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, String message)81 public TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, String message) { 82 super(errors, message); 83 } 84 TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, Throwable e)85 public TokenServerMalformedResponseException(List<ExtendedJSONObject> errors, Throwable e) { 86 super(errors, e); 87 } 88 } 89 } 90