Errorping is a lightweight library for Spring Boot that sends detailed error logs via Discord webhooks in real-time.
- Spring Boot 3.5.4
- JDK 17
- Servlet-based stack (
spring-boot-starter-web)
- Discord Webhook Integration: Sends highly readable Embed messages including status codes, request URL, and exception class.
- Ready-to-use Templates: Provides a pre-configured GlobalExceptionHandler and Logback configuration for immediate integration.
- Easy Configuration: Enable Discord alerting simply via application.yml without any additional code modifications.
In the errorping project:
./gradlew publishToMavenLocalThen, in your application:
dependencies {
implementation "com.jhssong:errorping:0.0.0-SNAPSHOT"
}Check most recent version at here
repositories {
maven {
url = uri("https://maven.pkg.github.com/jhssong/errorping")
credentials {
username = project.findProperty("gpr.user")
password = project.findProperty("gpr.key")
}
}
}
dependencies {
implementation "com.jhssong:errorping:1.0.0"
}GitHub Packages requires authentication even for public repositories.
Errorping uses Spring Boot @ConfigurationProperties to load alert-related settings.
To enable Discord alerting, add the following to your application.yml:
errorping:
discord-webhook-url: ${DISCORD_WEBHOOK_URL}Inject ErrorpingService into your @RestControllerAdvice and call sendErrorToDiscord inside each
exception handler:
@Slf4j
@RestControllerAdvice
@RequiredArgsConstructor
public class GlobalExceptionHandler {
private final ErrorpingService errorpingService;
@ExceptionHandler(MethodArgumentNotValidException.class)
protected ResponseEntity<Void> handleMethodArgumentNotValidException(MethodArgumentNotValidException e,
HttpServletRequest request) {
String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
log.info("[400] Validation Failed: {}", message);
errorpingService.sendErrorToDiscord(e, HttpStatus.BAD_REQUEST, request, message);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
}
@ExceptionHandler(Exception.class)
protected ResponseEntity<Void> handleException(Exception e, HttpServletRequest request) {
log.error("[500] Internal Server Error", e);
errorpingService.sendErrorToDiscord(e, HttpStatus.INTERNAL_SERVER_ERROR, request, e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}For a full GlobalExceptionHandler covering more exception types and additional
usage patterns, check errorping-example.

