mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 09:47:58 +01:00
Add /v1/verification
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2023 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.mappers;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.ext.ExceptionMapper;
|
||||
import org.whispersystems.textsecuregcm.registration.RegistrationServiceSenderException;
|
||||
|
||||
public class RegistrationServiceSenderExceptionMapper implements ExceptionMapper<RegistrationServiceSenderException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(final RegistrationServiceSenderException exception) {
|
||||
return Response.status(Response.Status.BAD_GATEWAY)
|
||||
.entity(new SendVerificationCodeFailureResponse(exception.getReason(), exception.isPermanent()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public record SendVerificationCodeFailureResponse(RegistrationServiceSenderException.Reason reason,
|
||||
boolean permanentFailure) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user