How do I track API errors?

Last reviewed: 12/2/2009

HOW Article ID: H090809

The information in this article applies to:

  • GrammarKit 3
  • LexiconKit 3
  • ProfileKit 3
  • SpeechKit 6
  • VoiceMarkupKit 3

Summary

The GrammarKit (ChantGM), ProfileKit (ChantPM), SpeechKit (ChantAudio, ChantSR, and ChantTTS), and VoiceMarkupKit (ChantVM) components isolate the application from many low-level API issues by design. However, API transparency may make for difficult debugging in cases where the problem is unclear.

A new callback event is available to return API errors directly to the application.

More Information

CCAPIError ChantCallback constant is available to register for API error events. This provides a way to track API error conditions and debug API- or engine-specific problems.

The CCAPIError event sets the following event property values:

  • ID - return code from the invoking the API function,
  • Function - API function invoked that generated the error, and
  • Text - error message description if available.

CCAPIError events can be tracked interactively with the Chant Developer Workbench development and testing environment. This provides a comprehensive testing and diagnostic tool for debugging applications.

The following sample illustrates registering for the CCAPIError events:


// Register for the API errors with GrammarKit 3
ChantGM.RegisterCallback(CCAPIError)
// Register for the API errors with ProfileKit 3
ChantPM.RegisterCallback(CCAPIError)
// Register for the API errors with SpeechKit 6
ChantAudio.RegisterCallback(CCAPIError)
ChantSR.RegisterCallback(CCAPIError)
ChantTTS.RegisterCallback(CCAPIError)
// Register for the API errors with VoiceMarkupKit 3
ChantVM.RegisterCallback(CCAPIError)