Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to handle unknown Intents #9

Closed
OverloadUT opened this issue Jun 29, 2015 · 4 comments
Closed

Add a way to handle unknown Intents #9

OverloadUT opened this issue Jun 29, 2015 · 4 comments

Comments

@OverloadUT
Copy link
Contributor

From the docs, it doesn't seem like it's possible to capture an IntentRequest that doesn't match any of the registered Intents.

I think it'd be best to handle it using the same app.intent method, but with a null intent name:

app.intent(null, function(request,response) {
    // Stuff to do if we get an unknown Intent!
});
@matt-kruse
Copy link
Collaborator

What do you want to do if you get an unknown intent? Currently, it will respond with the message in messages.NO_INTENT_FOUND, which by default is "Sorry, the application didn't know what to do with that intent". You can change this message to be anything you wish.

@OverloadUT
Copy link
Contributor Author

It would depend on the application. For some I would just have it abort with no message. For others I might want to kick it over to a prompt for how to use the app.

Most importantly though, I'd want to log the event, as it's a programmer error if this ever happens!

@matt-kruse
Copy link
Collaborator

As noted in the other issue, you can catch the exception using app.error, then log and re-prompt the user if you wish. Does that work for you?

@OverloadUT
Copy link
Contributor Author

That's certainly possible. It's an event that SHOULDN'T really happen, so relegating it to being part of the error handler can make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants