Skip to content

Commit 0b4c4ae

Browse files
committed
- fix Baseflow#1557 with testerror
1 parent fc9933f commit 0b4c4ae

File tree

2 files changed

+264
-255
lines changed

2 files changed

+264
-255
lines changed
Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,53 @@
11
package com.baseflow.geolocator.errors;
22

33
public enum ErrorCodes {
4-
activityMissing,
5-
errorWhileAcquiringPosition,
6-
locationServicesDisabled,
7-
permissionDefinitionsNotFound,
8-
permissionDenied,
9-
permissionRequestInProgress;
4+
activityMissing,
5+
errorWhileAcquiringPosition,
6+
locationServicesDisabled,
7+
locationServicesFailed,
8+
permissionDefinitionsNotFound,
9+
permissionDenied,
10+
permissionRequestInProgress;
1011

11-
public String toString() {
12-
switch (this) {
13-
case activityMissing:
14-
return "ACTIVITY_MISSING";
15-
case errorWhileAcquiringPosition:
16-
return "ERROR_WHILE_ACQUIRING_POSITION";
17-
case locationServicesDisabled:
18-
return "LOCATION_SERVICES_DISABLED";
19-
case permissionDefinitionsNotFound:
20-
return "PERMISSION_DEFINITIONS_NOT_FOUND";
21-
case permissionDenied:
22-
return "PERMISSION_DENIED";
23-
case permissionRequestInProgress:
24-
return "PERMISSION_REQUEST_IN_PROGRESS";
25-
default:
26-
throw new IndexOutOfBoundsException();
12+
public String toString() {
13+
switch (this) {
14+
case activityMissing:
15+
return "ACTIVITY_MISSING";
16+
case errorWhileAcquiringPosition:
17+
return "ERROR_WHILE_ACQUIRING_POSITION";
18+
case locationServicesDisabled:
19+
return "LOCATION_SERVICES_DISABLED";
20+
case locationServicesFailed:
21+
return "LOCATION_SERVICES_FAILED";
22+
case permissionDefinitionsNotFound:
23+
return "PERMISSION_DEFINITIONS_NOT_FOUND";
24+
case permissionDenied:
25+
return "PERMISSION_DENIED";
26+
case permissionRequestInProgress:
27+
return "PERMISSION_REQUEST_IN_PROGRESS";
28+
default:
29+
throw new IndexOutOfBoundsException();
30+
}
2731
}
28-
}
2932

30-
public String toDescription() {
31-
switch (this) {
32-
case activityMissing:
33-
return "Activity is missing. This might happen when running a certain function from the background that requires a UI element (e.g. requesting permissions or enabling the location services).";
34-
case errorWhileAcquiringPosition:
35-
return "An unexpected error occurred while trying to acquire the device's position.";
36-
case locationServicesDisabled:
37-
return "Location services are disabled. To receive location updates the location services should be enabled.";
38-
case permissionDefinitionsNotFound:
39-
return "No location permissions are defined in the manifest. Make sure at least ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION are defined in the manifest.";
40-
case permissionDenied:
41-
return "User denied permissions to access the device's location.";
42-
case permissionRequestInProgress:
43-
return "Already listening for location updates. If you want to restart listening please cancel other subscriptions first";
44-
default:
45-
throw new IndexOutOfBoundsException();
33+
public String toDescription() {
34+
switch (this) {
35+
case activityMissing:
36+
return "Activity is missing. This might happen when running a certain function from the background that requires a UI element (e.g. requesting permissions or enabling the location services).";
37+
case errorWhileAcquiringPosition:
38+
return "An unexpected error occurred while trying to acquire the device's position.";
39+
case locationServicesDisabled:
40+
return "Location services are disabled. To receive location updates the location services should be enabled.";
41+
case locationServicesFailed:
42+
return "Location services failed.";
43+
case permissionDefinitionsNotFound:
44+
return "No location permissions are defined in the manifest. Make sure at least ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION are defined in the manifest.";
45+
case permissionDenied:
46+
return "User denied permissions to access the device's location.";
47+
case permissionRequestInProgress:
48+
return "Already listening for location updates. If you want to restart listening please cancel other subscriptions first";
49+
default:
50+
throw new IndexOutOfBoundsException();
51+
}
4652
}
47-
}
4853
}

0 commit comments

Comments
 (0)