fix(inbound): 인자 변환 실패는 원인의 carrier와 상관없이 거부로 본다
문제(round8 리뷰 01 「Declined to judge」, 리뷰 README 19.4절 ④): - 결정 「감싼 carrier를 전송이 읽는 법」이 인자 변환 단계까지 덮는지 정해지지 않았다. STOMP advice는 @DestinationVariable·@Header의 ConversionFailedException과 받은 메시지가 실린 MessageConversionException의 원인에 carrier가 있으면 거부 WARN 한 줄 대신 그 carrier의 줄(5xx면 ERROR와 예외)을 남긴다. web은 같은 실패에 원인을 보지 않고 BAD_PARAMETER·VALIDATION_FAILED로 답한다. 고른 방법(소유자 결정 2026-11-07, ④ (a)): - 인자 변환 단계는 carrier를 보지 않는다. StompHandlerFailureLog가 거부 판정(clientRefusalOf)을 원인 사슬의 carrier 검색보다 먼저 한다. 응답 프레임은 그대로다(handler 경로는 프레임을 보내지 않는다). - web은 지금 동작이 결정과 같아 코드를 바꾸지 않았다. 경로 변수 변환기와 Jackson creator가 carrier를 던지는 지킴 테스트 둘을 더하고, handleTypeMismatch·handleHttpMessageNotReadable Javadoc에 이유를 적었다. - GraphQL @Argument binder는 변환기가 던진 실패를 binding result에 담고 BindException의 원인으로 싣지 않아, carrier를 던져도 BAD_PARAMETER다. 실제 binder 경로 지킴 테스트 하나와 매퍼 Javadoc·README 한 줄. - 버린 안: (b) 세 전송의 변환 단계가 원인의 carrier를 먼저 본다 — 요청 형식 오류의 코드가 변환기 구현에 따라 바뀐다. 위험·한계: - 바뀌는 것은 STOMP 로그 줄뿐이다. 템플릿에는 carrier를 던지는 변환기가 없다. 안내 B-46에 적었다. - GraphQL 지킴 테스트는 Spring for GraphQL 2.0.5 binder의 동작에 기댄다. binder가 원인을 싣게 바뀌면 그 테스트가 실패한다. 검증(desktop, flock, --no-build-cache, 로그 ~/r9-g1-inbound-logs/): - RED(기준3eb3b067+ 테스트만, 트리 4feb83c6): :adapter:inbound:websocket:test --tests StompHandlerFailureLogTest rc=1, 13건 중 2건 실패. 두 경우 모두 기대 WARN "request refused as VALIDATION_FAILED|BAD_PARAMETER by <변환 예외>", 실제 ERROR "persistence failure classified as DB_UNAVAILABLE ...". red/R2c-websocket.log - 지킴(RED 없음 — 지금 동작이 결정과 같다): web TransportErrorHandlingTest 12건(red/R3c-web-guard.log)과 GraphQlArgumentBindingFailureTest (트리 7c45e303, red/R1b-graphql.log)가 기준 커밋에서 통과. 변이: handleTypeMismatch가 원인의 carrier를 먼저 보게 바꾸면 12건 중 1건 (경로 변수) 실패, 400 대신 503. red/R7c-web-guard-mutant.log - GREEN(이 커밋 트리1a5b4a8f): :adapter:inbound:websocket:check :adapter:inbound:web:check :adapter:inbound:graphql:check :shared-contract:check rc=0, websocket 107·web 343·graphql 408· shared-contract 269건 실패 0·skip 0, FROM-CACHE 0. green2/B1-check.log - testQualityCheck 첫 실행(green/D16)에서 이 커밋의 테스트 record 둘 (Signup, `if (email != null)`)이 SpotBugs NP_LOAD_OF_KNOWN_NULL_VALUE로 걸려 `!email.isEmpty()`로 고쳤다. 고친 테스트로 RED·지킴·변이를 다시 돌렸고(위 R2c·R3c·R7c), 마지막 트리에서 web·websocket spotbugsTest가 실행되어 통과했다(green2/D16). Refs: docs/reviews/2026-11-03-rereview/README.md 19.4절 ④, round8/01-transport-errors.md 「Declined to judge」
This commit is contained in:
@@ -77,7 +77,9 @@ instrumentation, data fetcher resolver 세 곳이 같은 bean 을 받는다).
|
||||
감싼 carrier 를 그 코드로 매핑(재리뷰 RR7-01-05).
|
||||
5. **`IllegalArgumentException`과 인자 binder의 `BindException`** → `BAD_PARAMETER`(`REQUEST`, `BAD_REQUEST`) —
|
||||
web·gRPC·STOMP 와 같다. `BindException`은 `@Argument` 값이 파라미터 타입으로 바뀌지 않을 때 Spring 이 컨트롤러
|
||||
전에 던진다(web 의 경로 변수 변환 실패와 같은 답, 소유자 결정 2026-11-07). 로그도 같은 WARN 한 줄
|
||||
전에 던진다(web 의 경로 변수 변환 실패와 같은 답, 소유자 결정 2026-11-07). 변환기가 던진 실패는 binding
|
||||
result 에 남고 원인으로 실리지 않아, 변환기가 carrier 를 던져도 답은 `BAD_PARAMETER`다(인자 변환 단계는 carrier 를
|
||||
보지 않는다, 소유자 결정 2026-11-07). 로그도 같은 WARN 한 줄
|
||||
`request refused as BAD_PARAMETER by <예외 타입> (executionId=<id>)` 이고, 입력값이 들 수 있는 메시지
|
||||
(`BindException`은 `rejected value [...]`)는 남기지 않는다.
|
||||
6. 나머지는 `INTERNAL_ERROR` 로 가려지고 같은 executionId 로 ERROR 로그 한 줄이 남는다.
|
||||
|
||||
+4
@@ -130,6 +130,10 @@ public final class GraphQlWireErrorMapper {
|
||||
* Spring for GraphQL's argument binder raises when an {@code @Argument} the client sent does not
|
||||
* convert to the parameter's type, as the web adapter answers a path variable that does not
|
||||
* (owner decision 2026-11-07).
|
||||
*
|
||||
* <p>The binder keeps a converter's failure in the binding result, not as a cause, so a carrier a
|
||||
* converter throws never answers in place of {@code BAD_PARAMETER}: the argument conversion stage
|
||||
* does not read a carrier (owner decision 2026-11-07).
|
||||
*/
|
||||
public GraphQlWireError map(Throwable failure, GraphQlErrorContext context) {
|
||||
if (failure instanceof GraphQlPlatformRejection rejection) {
|
||||
|
||||
+40
-1
@@ -7,10 +7,13 @@ import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.read.ListAppender;
|
||||
import dev.caskeleton.adapter.inbound.graphql.error.GraphQlWireErrorMapper;
|
||||
import dev.caskeleton.shared.error.OperationalError;
|
||||
import dev.caskeleton.shared.error.PersistenceFailureException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -33,7 +36,8 @@ import org.springframework.stereotype.Controller;
|
||||
*/
|
||||
class GraphQlArgumentBindingFailureTest {
|
||||
|
||||
private static final String SCHEMA = "type Query { order(id: ID!): String }";
|
||||
private static final String SCHEMA =
|
||||
"type Query { order(id: ID!): String invoice(number: String!): String }";
|
||||
|
||||
private static final String QUERY = "{ order(id: \"alice@example.com\") }";
|
||||
|
||||
@@ -71,6 +75,21 @@ class GraphQlArgumentBindingFailureTest {
|
||||
null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("변환기가 carrier 를 던져도 인자 변환 실패는 BAD_PARAMETER 다(인자 변환 단계는 carrier 를 보지 않는다)")
|
||||
void anArgumentWhoseConverterThrowsACarrierIsStillABadParameterRequestError() {
|
||||
// when
|
||||
List<ResponseError> errors = errorsOf("{ invoice(number: \"INV-1\") }");
|
||||
|
||||
// then
|
||||
assertThat(errors)
|
||||
.singleElement()
|
||||
.extracting(
|
||||
error -> error.getExtensions().get("code"),
|
||||
error -> error.getExtensions().get("category"))
|
||||
.containsExactly("BAD_PARAMETER", "REQUEST");
|
||||
}
|
||||
|
||||
private static List<ResponseError> errorsOf(String document) {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
context.registerBean(OrderController.class);
|
||||
@@ -123,5 +142,25 @@ class GraphQlArgumentBindingFailureTest {
|
||||
String order(@Argument UUID id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
@QueryMapping
|
||||
String invoice(@Argument InvoiceNumber number) {
|
||||
return "unreachable: the number never converts";
|
||||
}
|
||||
}
|
||||
|
||||
/** An argument type whose conversion fails with a server-side carrier, as a lookup could. */
|
||||
public static final class InvoiceNumber {
|
||||
|
||||
private InvoiceNumber() {}
|
||||
|
||||
/** The conversion the binder finds; a lookup that fails with a carrier for any number. */
|
||||
public static InvoiceNumber valueOf(String value) {
|
||||
if (!value.isEmpty()) {
|
||||
throw new PersistenceFailureException(
|
||||
OperationalError.DB_UNAVAILABLE, "invoice lookup failed for " + value, null);
|
||||
}
|
||||
return new InvoiceNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,11 @@ commit-aware response wrapper 계약을 구현한다. 또한 이 모듈은 HTML
|
||||
원인 사슬의 첫 carrier(`ApiErrorCarrier.firstIn`)를 찾아 `handleCarrier` 로 넘긴다. 감싼
|
||||
persistence 실패도 500 `INTERNAL_ERROR` 와 SQL 원인 대신 그 분류 코드와 분류 한 줄로 남는다. GraphQL·gRPC·STOMP
|
||||
도 같은 함수를 쓴다(소유자 결정 2026-11-06, 재리뷰 RR7-01-05).
|
||||
- 인자 변환 단계는 원인의 carrier 를 보지 않는다. 경로 변수·쿼리 파라미터가 바뀌지 않은
|
||||
`MethodArgumentTypeMismatchException` 은 `BAD_PARAMETER`, 읽지 못한 본문의 `HttpMessageNotReadableException` 은
|
||||
`VALIDATION_FAILED` 다. 사용자 `Converter` 나 Jackson creator 가 carrier 를 던져 그 원인에 있어도 같다. 요청
|
||||
형식 오류이고 그 코드는 전송이 정한다(소유자 결정 2026-11-07, 재리뷰 README 19.4절 ④). STOMP 도 같은 실패를
|
||||
거부로 남긴다. 단언은 `TransportErrorHandlingTest`.
|
||||
- 개별 override 가 없는 Spring MVC 예외(필수 파라미터·헤더·part 누락, binding 실패 등)는
|
||||
`handleExceptionInternal` override 가 상태 코드 → 코드로 바꿔 같은 Envelope 로 보낸다. 503(Spring 의
|
||||
async 요청 시간 초과)은 `INTERNAL_ERROR` 가 아니라 `REQUEST_TIMEOUT`(503, retryable) 이다(리뷰 02-08).
|
||||
|
||||
+11
@@ -108,6 +108,12 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
return ErrorResponseFactory.envelope(OperationalError.VALIDATION_FAILED, violations);
|
||||
}
|
||||
|
||||
/**
|
||||
* A path variable, query parameter or header that does not convert to its parameter's type is
|
||||
* {@code BAD_PARAMETER}, whatever the conversion threw: a carrier a user {@code Converter} threw
|
||||
* is not searched for, because the argument conversion stage answers a malformed request with the
|
||||
* transport's own code (owner decision 2026-11-07). STOMP logs the same failure as a refusal.
|
||||
*/
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public ResponseEntity<Envelope<Void>> handleTypeMismatch(MethodArgumentTypeMismatchException ex) {
|
||||
Class<?> requiredType = ex.getRequiredType();
|
||||
@@ -224,6 +230,11 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
HttpStatusCode.valueOf(OperationalError.VALIDATION_FAILED.httpStatus()));
|
||||
}
|
||||
|
||||
/**
|
||||
* An unreadable body is {@code VALIDATION_FAILED}, or {@code PAYLOAD_TOO_LARGE} when the body
|
||||
* ceiling cut the read. A carrier a Jackson creator threw is not searched for, for the same
|
||||
* reason as {@link #handleTypeMismatch}.
|
||||
*/
|
||||
@Override
|
||||
protected ResponseEntity<Object> handleHttpMessageNotReadable(
|
||||
HttpMessageNotReadableException ex,
|
||||
|
||||
+66
@@ -12,6 +12,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
import dev.caskeleton.adapter.inbound.web.conditional.PreconditionFailedException;
|
||||
import dev.caskeleton.adapter.inbound.web.envelope.EnvelopeBodyAdvice;
|
||||
import dev.caskeleton.adapter.inbound.web.pagination.PageValidationException;
|
||||
import dev.caskeleton.shared.error.OperationalError;
|
||||
import dev.caskeleton.shared.error.PersistenceFailureException;
|
||||
import dev.caskeleton.shared.tracing.SpanErrorRecorder;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import java.util.List;
|
||||
@@ -24,6 +26,7 @@ import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.HttpMediaTypeNotAcceptableException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
@@ -150,9 +153,47 @@ class TransportErrorHandlingTest {
|
||||
.andExpect(jsonPath("$.error.details[0].rejectedValue").doesNotExist());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("경로 변수 변환기가 던진 carrier 는 원인에 있어도 보지 않는다: 400 BAD_PARAMETER(인자 변환 단계)")
|
||||
void aPathVariableWhoseConverterThrowsACarrierIsStillABadParameter() throws Exception {
|
||||
// when
|
||||
var result = mvc.perform(get("/t/invoices/INV-1"));
|
||||
|
||||
// then
|
||||
result
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(jsonPath("$.error.code").value("BAD_PARAMETER"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("본문 생성자가 던진 carrier 는 원인에 있어도 보지 않는다: 400 VALIDATION_FAILED(인자 변환 단계)")
|
||||
void aBodyWhoseCreatorThrowsACarrierIsStillValidationFailed() throws Exception {
|
||||
// when
|
||||
var result =
|
||||
mvc.perform(
|
||||
post("/t/signup")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"email\": \"alice@example.com\"}"));
|
||||
|
||||
// then
|
||||
result
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(jsonPath("$.error.code").value("VALIDATION_FAILED"));
|
||||
}
|
||||
|
||||
@RestController
|
||||
static class Probe {
|
||||
|
||||
@GetMapping("/t/invoices/{number}")
|
||||
Map<String, String> invoice(@PathVariable("number") InvoiceNumber number) {
|
||||
return Map.of("ok", "unreachable: the number never converts");
|
||||
}
|
||||
|
||||
@PostMapping(value = "/t/signup", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
Map<String, String> signup(@RequestBody Signup signup) {
|
||||
return Map.of("ok", "unreachable: the body never reads");
|
||||
}
|
||||
|
||||
@GetMapping("/t/async-timeout")
|
||||
Map<String, String> asyncTimeout() {
|
||||
throw new AsyncRequestTimeoutException();
|
||||
@@ -203,4 +244,29 @@ class TransportErrorHandlingTest {
|
||||
throw new PageValidationException("size", "SIZE_EXCEEDS_MAX", "size must be <= 100");
|
||||
}
|
||||
}
|
||||
|
||||
/** A path-variable type whose conversion fails with a server-side carrier, as a lookup could. */
|
||||
public static final class InvoiceNumber {
|
||||
|
||||
private InvoiceNumber() {}
|
||||
|
||||
/** The conversion Spring finds; a lookup that fails with a carrier for any number. */
|
||||
public static InvoiceNumber valueOf(String value) {
|
||||
if (!value.isEmpty()) {
|
||||
throw new PersistenceFailureException(
|
||||
OperationalError.DB_UNAVAILABLE, "invoice lookup failed for " + value, null);
|
||||
}
|
||||
return new InvoiceNumber();
|
||||
}
|
||||
}
|
||||
|
||||
/** A request body whose creator fails with a server-side carrier for any address. */
|
||||
record Signup(String email) {
|
||||
Signup {
|
||||
if (!email.isEmpty()) {
|
||||
throw new PersistenceFailureException(
|
||||
OperationalError.DB_UNAVAILABLE, "signup lookup failed", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
|
||||
이 예외들의 메시지는 받은 JSON 조각이나 값을 담는다. 그래서 타입만 남긴다. 응답을 JSON으로 쓰지 못한
|
||||
`MessageConversionException`은 받은 메시지가 실리지 않는다. 서버 탓이라 ERROR로 남는다.
|
||||
|
||||
이 거부는 원인 사슬의 carrier보다 먼저 판정한다. payload creator나 destination 변수 타입의 변환이 carrier를
|
||||
던져도(조회하다 DB 실패 등) 인자를 거부한 것이라 같은 WARN 한 줄이다. web이 읽지 못한 본문과 바뀌지 않는 경로
|
||||
변수에 원인과 상관없이 `VALIDATION_FAILED`·`BAD_PARAMETER`로 답하는 것과 같다. 인자 변환 단계는 carrier를 보지
|
||||
않는다(소유자 결정 2026-11-07, 재리뷰 README 19.4절 ④).
|
||||
- 그 밖의 예외는 예외와 함께 ERROR. 전에는 Spring이 예외 전체(persistence 실패의 SQL 원인 포함)를 ERROR로 남겼다.
|
||||
필수 header·destination 변수가 없을 때의 `MessageHandlingException`도 ERROR다. 메시지에 입력값이 없고, Spring이
|
||||
같은 타입으로 서버 실패도 감싸서 타입만으로는 클라이언트 탓을 가를 수 없다(결정 색인 기본값 2026-11-07).
|
||||
|
||||
+12
-6
@@ -42,6 +42,12 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
* BAD_PARAMETER}, like a path variable). Their messages quote the input, so they are not logged. A
|
||||
* reply the converter could not write is the server's failure: Spring raises the same {@link
|
||||
* MessageConversionException} for it, but without a failed message, and it stays an error.
|
||||
*
|
||||
* <p>Those refusals are judged before the cause chain is searched for a carrier. A converter that
|
||||
* throws a carrier — a payload creator or a destination-variable type that looks something up —
|
||||
* still made a refusal of the argument, as the web adapter answers an unreadable body or a path
|
||||
* variable that does not convert whatever their cause: the argument conversion stage does not read
|
||||
* a carrier (owner decision 2026-11-07).
|
||||
*/
|
||||
@ControllerAdvice
|
||||
class StompHandlerFailureLog {
|
||||
@@ -50,6 +56,12 @@ class StompHandlerFailureLog {
|
||||
|
||||
@MessageExceptionHandler
|
||||
void logFailure(Exception failure) {
|
||||
Optional<ApiErrorCode> refusal = clientRefusalOf(failure);
|
||||
if (refusal.isPresent()) {
|
||||
ServerFailureLog line = ServerFailureLog.refused(refusal.get(), failure);
|
||||
log.warn(line.format(""), line.arguments());
|
||||
return;
|
||||
}
|
||||
Optional<Throwable> carrier = ApiErrorCarrier.firstIn(failure);
|
||||
if (carrier.isPresent()) {
|
||||
ServerFailureLog.of(carrier.get(), ((ApiErrorCarrier) carrier.get()).errorCode())
|
||||
@@ -61,12 +73,6 @@ class StompHandlerFailureLog {
|
||||
log.warn(line.format(""), line.arguments());
|
||||
return;
|
||||
}
|
||||
Optional<ApiErrorCode> refusal = clientRefusalOf(failure);
|
||||
if (refusal.isPresent()) {
|
||||
ServerFailureLog line = ServerFailureLog.refused(refusal.get(), failure);
|
||||
log.warn(line.format(""), line.arguments());
|
||||
return;
|
||||
}
|
||||
log.error("unhandled failure in a STOMP message handler", failure);
|
||||
}
|
||||
|
||||
|
||||
+64
@@ -183,6 +183,39 @@ class StompHandlerFailureLogTest {
|
||||
.containsExactly(Level.WARN, "request refused as " + code + " by " + failureType, null);
|
||||
}
|
||||
|
||||
/** Arguments whose conversion threw a server-side carrier: the converter, not the use case. */
|
||||
static Stream<Arguments> conversionRefusalsAroundACarrier() {
|
||||
return Stream.of(
|
||||
Arguments.of(
|
||||
"/app/signup",
|
||||
"{\"email\": \"alice@example.com\"}".getBytes(StandardCharsets.UTF_8),
|
||||
"VALIDATION_FAILED",
|
||||
"org.springframework.messaging.converter.MessageConversionException"),
|
||||
Arguments.of(
|
||||
"/app/invoices/INV-1",
|
||||
new byte[0],
|
||||
"BAD_PARAMETER",
|
||||
"org.springframework.core.convert.ConversionFailedException"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("conversionRefusalsAroundACarrier")
|
||||
@DisplayName("변환기가 던진 carrier 를 원인으로 든 인자 변환 실패도 거부로 WARN 한 줄이다(인자 변환 단계는 carrier 를 보지 않는다)")
|
||||
void aConversionRefusalAroundACarrierIsStillLoggedAsARefusal(
|
||||
String destination, byte[] payload, String code, String failureType) {
|
||||
// when
|
||||
List<ILoggingEvent> logged = loggedWhileHandling(destination, payload, Map.of());
|
||||
|
||||
// then
|
||||
assertThat(logged)
|
||||
.singleElement()
|
||||
.extracting(
|
||||
ILoggingEvent::getLevel,
|
||||
ILoggingEvent::getFormattedMessage,
|
||||
ILoggingEvent::getThrowableProxy)
|
||||
.containsExactly(Level.WARN, "request refused as " + code + " by " + failureType, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void aReplyTheConverterCannotWriteIsLoggedAtErrorWithTheFailure() {
|
||||
// when
|
||||
@@ -321,6 +354,12 @@ class StompHandlerFailureLogTest {
|
||||
@MessageMapping("/count")
|
||||
void count(@Header("count") int count) {}
|
||||
|
||||
@MessageMapping("/signup")
|
||||
void signup(@Payload Signup signup) {}
|
||||
|
||||
@MessageMapping("/invoices/{number}")
|
||||
void invoice(@DestinationVariable InvoiceNumber number) {}
|
||||
|
||||
@MessageMapping("/unwritable-reply")
|
||||
UnwritableReply unwritableReply() {
|
||||
return new UnwritableReply();
|
||||
@@ -340,6 +379,31 @@ class StompHandlerFailureLogTest {
|
||||
/** A payload a client sends as JSON. */
|
||||
record Greeting(String name) {}
|
||||
|
||||
/** A payload whose creator fails with a server-side carrier for any address. */
|
||||
record Signup(String email) {
|
||||
Signup {
|
||||
if (!email.isEmpty()) {
|
||||
throw new PersistenceFailureException(
|
||||
OperationalError.DB_UNAVAILABLE, "signup lookup failed", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A destination-variable type whose conversion fails with a server-side carrier. */
|
||||
public static final class InvoiceNumber {
|
||||
|
||||
private InvoiceNumber() {}
|
||||
|
||||
/** The conversion Spring finds; a lookup that fails with a carrier for any number. */
|
||||
public static InvoiceNumber valueOf(String value) {
|
||||
if (!value.isEmpty()) {
|
||||
throw new PersistenceFailureException(
|
||||
OperationalError.DB_UNAVAILABLE, "invoice lookup failed for " + value, null);
|
||||
}
|
||||
return new InvoiceNumber();
|
||||
}
|
||||
}
|
||||
|
||||
/** A reply the JSON converter cannot write: its only property is itself. */
|
||||
static final class UnwritableReply {
|
||||
public UnwritableReply getSelf() {
|
||||
|
||||
@@ -89,6 +89,9 @@ Spring/Lettuce 타입을 노출하지 않는다.
|
||||
- 원인 사슬의 carrier 보다 먼저 답하는 것이 있다.
|
||||
- GraphQL 에서 앱이 `GraphQlExceptionResolver` 에 등록한 실패 타입은 원인에 carrier 가 있어도 등록한 코드로
|
||||
답한다. 실패 자신이 carrier 면 그 코드가 등록 매핑보다 먼저다(소유자 결정 2026-11-07, 재리뷰 README 19.4절 ①).
|
||||
- 인자 변환 단계(web 경로 변수·본문, STOMP payload·destination 변수·header, GraphQL `@Argument` binder)의 실패는
|
||||
원인에 carrier 가 있어도 거부(`BAD_PARAMETER`·`VALIDATION_FAILED`)다(소유자 결정 2026-11-07, 재리뷰 README
|
||||
19.4절 ④).
|
||||
|
||||
### ServerFailureLog — 모든 전송이 같은 로그 줄로
|
||||
- carrier로 답한 실패의 서버 로그 줄을 정한다. web·GraphQL·gRPC·STOMP 어댑터가 이 클래스 하나를 쓴다
|
||||
|
||||
@@ -37,6 +37,10 @@ public interface ApiErrorCarrier {
|
||||
* <p>A mapping a GraphQL application registered for the failure's own type answers before a
|
||||
* carrier found behind the failure (owner decision 2026-11-07).
|
||||
*
|
||||
* <p>An argument that did not convert is refused by each transport's argument conversion stage
|
||||
* whatever the conversion threw; that stage does not search for a carrier (owner decision
|
||||
* 2026-11-07).
|
||||
*
|
||||
* @param failure the failure a transport is answering; may be {@code null}
|
||||
* @return the carrier as the throwable it is — hand that to {@link ServerFailureLog#of}, not the
|
||||
* wrapper, so its type still decides what may be logged
|
||||
|
||||
Reference in New Issue
Block a user