Skip to content

Commit

Permalink
error adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Oct 6, 2023
1 parent 24d1e8c commit 080b76d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ protected void onCreate(Bundle savedInstanceState) {
.build(getApplicationContext(), porcupineManagerCallback);

} catch (PorcupineInvalidArgumentException e) {
onPorcupineInitError(
String.format("%s\nEnsure your accessKey '%s' is a valid access key.", e.getMessage(), ACCESS_KEY)
);
onPorcupineInitError(e.getMessage());
} catch (PorcupineActivationException e) {
onPorcupineInitError("AccessKey activation error");
} catch (PorcupineActivationLimitException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
porcupineManager.start();

} catch (PorcupineInvalidArgumentException e) {
onPorcupineInitError(
String.format("%s\nEnsure your accessKey '%s' is a valid access key.", e.getMessage(), ACCESS_KEY)
);
onPorcupineInitError(e.getMessage());
} catch (PorcupineActivationException e) {
onPorcupineInitError("AccessKey activation error");
} catch (PorcupineActivationLimitException e) {
Expand All @@ -95,12 +93,12 @@ public int onStartCommand(Intent intent, int flags, int startId) {
} catch (PorcupineActivationThrottledException e) {
onPorcupineInitError("AccessKey has been throttled");
} catch (PorcupineException e) {
onPorcupineInitError("Failed to initialize Porcupine " + e.getMessage());
onPorcupineInitError("Failed to initialize Porcupine: " + e.getMessage());
}

Notification notification = porcupineManager == null ?
getNotification("Porcupine init failed", "Service will be shut down") :
getNotification("Wake word", "Service running");
getNotification("Wake word service", "Say 'Porcupine'!");
startForeground(1234, notification);

return super.onStartCommand(intent, flags, startId);
Expand Down

0 comments on commit 080b76d

Please sign in to comment.