0

I have made a program with PocketSphinx for Android, but there is one problem. Sometimes I have errors such as

ERROR: "kws_search.c", line 164: The word 'sadfasdf' is missing in the dictionary". 

and then the whole program crashes. I know why the error comes up, but is there a way to deal with the error gracefully? I am more concerned about having the error not crash the program as opposed to fixing the error. It seems like I have to do something in the onError(Exception e) method, but I'm not sure what.

(There's a similar question here Handling Errors in PocketSphinx Android app which says it has been handled, but mine still crashes, although I'm sure I'm just not doing something correctly in onError())

My log is as follows:

FATAL EXCEPTION: main
Process: com.company.app, PID: 26044                                                                   
java.lang.RuntimeException: Decoder_setKws returned -1

EDIT: I think it's just a standard RuntimeException which I don't know yet how to handle - how do I deal with them?

Community
  • 1
  • 1
user124577
  • 109
  • 1
  • 2
  • 8

1 Answers1

0

You can catch exceptions with try/catch.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87