improve PR merge error handling

There was the possibility of an uncaught exception if an invalid PR was provided. This catches that exception and replies indicating the error.

While doing this the cyclomatic complexity of `pr_merge()` got a bit nuts, so some business logic was removed from the method and put in `merge_pr()`.