Made webhook bots print exceptions stacktrace to stderr instead of silently swallowing them.
This commit is contained in:
parent
e6b9fd892f
commit
6fcd4d85c1
@ -0,0 +1,20 @@
|
||||
package org.telegram.telegrambots.updatesreceivers;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.ext.ExceptionMapper;
|
||||
|
||||
/**
|
||||
* Prints exceptions in webhook bots to stderr
|
||||
*
|
||||
* @author Mouamle
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DefaultExceptionMapper implements ExceptionMapper<Throwable> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(Throwable exception) {
|
||||
exception.printStackTrace();
|
||||
return Response.serverError().build();
|
||||
}
|
||||
|
||||
}
|
@ -52,6 +52,7 @@ public class DefaultWebhook implements Webhook {
|
||||
ResourceConfig rc = new ResourceConfig();
|
||||
rc.register(restApi);
|
||||
rc.register(JacksonFeature.class);
|
||||
rc.register(DefaultExceptionMapper.class);
|
||||
|
||||
final HttpServer grizzlyServer;
|
||||
if (keystoreServerFile != null && keystoreServerPwd != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user