Line data Source code
1 : /*
2 : * Package : mqtt_client
3 : * Author : S. Hamblett <steve.hamblett@linux.com>
4 : * Date : 31/05/2017
5 : * Copyright : S.Hamblett
6 : */
7 :
8 : part of mqtt_client;
9 :
10 : /// Exception thrown when the connection state is incorrect.
11 : class ConnectionException implements Exception {
12 : String _message;
13 :
14 : /// Length of 'ConnectionException.'
15 : static const int _classLength = 16;
16 :
17 1 : ConnectionException(ConnectionState state) {
18 1 : _message =
19 : "mqtt-client::ConnectionException: The connection must be in the Connected state in order to perform this operation. "
20 3 : "Current state is ${state.toString().substring(_classLength)}";
21 : }
22 :
23 : @override
24 1 : String toString() => _message;
25 : }
|