|
| 1 | +# /* |
| 2 | +# * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | +# * |
| 4 | +# * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | +# * You may not use this file except in compliance with the License. |
| 6 | +# * A copy of the License is located at |
| 7 | +# * |
| 8 | +# * http://aws.amazon.com/apache2.0 |
| 9 | +# * |
| 10 | +# * or in the "license" file accompanying this file. This file is distributed |
| 11 | +# * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | +# * express or implied. See the License for the specific language governing |
| 13 | +# * permissions and limitations under the License. |
| 14 | +# */ |
| 15 | + |
| 16 | +import core.exception.operationTimeoutException as operationTimeoutException |
| 17 | +import core.exception.operationError as operationError |
| 18 | + |
| 19 | + |
| 20 | +# Serial Exception |
| 21 | +class acceptTimeoutException(Exception): |
| 22 | + def __init__(self, msg="Accept Timeout"): |
| 23 | + self.message = msg |
| 24 | + |
| 25 | + |
| 26 | +# MQTT Operation Timeout Exception |
| 27 | +class connectTimeoutException(operationTimeoutException.operationTimeoutException): |
| 28 | + def __init__(self, msg="Connect Timeout"): |
| 29 | + self.message = msg |
| 30 | + |
| 31 | + |
| 32 | +class disconnectTimeoutException(operationTimeoutException.operationTimeoutException): |
| 33 | + def __init__(self, msg="Disconnect Timeout"): |
| 34 | + self.message = msg |
| 35 | + |
| 36 | + |
| 37 | +class publishTimeoutException(operationTimeoutException.operationTimeoutException): |
| 38 | + def __init__(self, msg="Publish Timeout"): |
| 39 | + self.message = msg |
| 40 | + |
| 41 | + |
| 42 | +class subscribeTimeoutException(operationTimeoutException.operationTimeoutException): |
| 43 | + def __init__(self, msg="Subscribe Timeout"): |
| 44 | + self.message = msg |
| 45 | + |
| 46 | + |
| 47 | +class unsubscribeTimeoutException(operationTimeoutException.operationTimeoutException): |
| 48 | + def __init__(self, msg="Unsubscribe Timeout"): |
| 49 | + self.message = msg |
| 50 | + |
| 51 | + |
| 52 | +# MQTT Operation Error |
| 53 | +class connectError(operationError.operationError): |
| 54 | + def __init__(self, errorCode): |
| 55 | + self.message = "Connect Error: " + str(errorCode) |
| 56 | + |
| 57 | + |
| 58 | +class disconnectError(operationError.operationError): |
| 59 | + def __init__(self, errorCode): |
| 60 | + self.message = "Disconnect Error: " + str(errorCode) |
| 61 | + |
| 62 | + |
| 63 | +class publishError(operationError.operationError): |
| 64 | + def __init__(self, errorCode): |
| 65 | + self.message = "Publish Error: " + str(errorCode) |
| 66 | + |
| 67 | + |
| 68 | +class publishQueueFullException(operationError.operationError): |
| 69 | + def __init__(self): |
| 70 | + self.message = "Internal Publish Queue Full" |
| 71 | + |
| 72 | + |
| 73 | +class publishQueueDisabledException(operationError.operationError): |
| 74 | + def __init__(self): |
| 75 | + self.message = "Offline publish request dropped because queueing is disabled" |
| 76 | + |
| 77 | + |
| 78 | +class subscribeError(operationError.operationError): |
| 79 | + def __init__(self, errorCode): |
| 80 | + self.message = "Subscribe Error: " + str(errorCode) |
| 81 | + |
| 82 | + |
| 83 | +class unsubscribeError(operationError.operationError): |
| 84 | + def __init__(self, errorCode): |
| 85 | + self.message = "Unsubscribe Error: " + str(errorCode) |
| 86 | + |
| 87 | + |
| 88 | +# Websocket Error |
| 89 | +class wssNoKeyInEnvironmentError(operationError.operationError): |
| 90 | + def __init__(self): |
| 91 | + self.message = "No AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY detected in $ENV." |
| 92 | + |
| 93 | + |
| 94 | +class wssHandShakeError(operationError.operationError): |
| 95 | + def __init__(self): |
| 96 | + self.message = "Error in WSS handshake." |
0 commit comments