/
exception.dart
86 lines (75 loc) · 2.3 KB
/
exception.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import 'package:nearby_service/nearby_service.dart';
const _kNearbyServiceMessage = 'Got error from native platform with status=';
///
/// Wi-Fi P2P is not supported on this device
///
class NearbyServiceP2PUnsupportedException extends NearbyServiceException {
NearbyServiceP2PUnsupportedException()
: super(
'${_kNearbyServiceMessage}P2P_UNSUPPORTED',
);
@override
String toString() {
return 'NearbyServiceP2PUnsupportedException{error: $error}';
}
}
///
/// The Wi-Fi P2P framework is currently busy.
/// Please wait for the current operation to complete before initiating another.
///
/// Usually this means that you have sent a request to some device and
/// now one of the peers is CONNECTING.
///
class NearbyServiceBusyException extends NearbyServiceException {
NearbyServiceBusyException()
: super(
'${_kNearbyServiceMessage}BUSY',
);
@override
String toString() {
return 'NearbyServiceBusyException{error: $error}';
}
}
///
/// No service discovery requests have been made. Ensure that you have
/// initiated a service discovery request before attempting to connect.
///
class NearbyServiceNoServiceRequestsException extends NearbyServiceException {
NearbyServiceNoServiceRequestsException()
: super(
'${_kNearbyServiceMessage}NO_SERVICE_REQUESTS',
);
@override
String toString() {
return 'NearbyServiceNoServiceRequestsException{error: $error}';
}
}
///
/// A generic error occurred. This could be due to various reasons such as
/// hardware issues, Wi-Fi being turned off, or temporary issues with the
/// Wi-Fi P2P framework.
///
class NearbyServiceGenericErrorException extends NearbyServiceException {
NearbyServiceGenericErrorException()
: super(
'${_kNearbyServiceMessage}ERROR',
);
@override
String toString() {
return 'NearbyServiceGenericErrorException{error: $error}';
}
}
///
/// An unknown error occurred. Please check the device's Wi-Fi
/// P2P settings and ensure the device supports Wi-Fi P2P.
///
class NearbyServiceUnknownException extends NearbyServiceException {
NearbyServiceUnknownException()
: super(
'${_kNearbyServiceMessage}UNKNOWN',
);
@override
String toString() {
return 'NearbyServiceUnknownException{error: $error}';
}
}