织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

Getting syntax error on Mono.onErrorResume() whil

时间:2025-08-07 06:09来源: 作者:admin 点击: 2 次
I am using java 17, spring-boot: 3.0.5 and maven in my project. I am calling a GraphQL endpoint using HttpGraphQlClient. Below is my expected code sni

I am using java 17, spring-boot: 3.0.5 and maven in my project. I am calling a GraphQL endpoint using HttpGraphQlClient. Below is my expected code snippet:

Mono<Entity> entity = this.graphQlClient.documentName("getDetails").variables(Map.of("xx", "xx")) .retrieve("data") .toEntity(Entity.class) .onErrorResume(FieldAccessException.class, ex -> { ClientGraphQlResponse response = ex.getResponse(); // ... ClientResponseField field = ex.getField(); // ... });

However, I am getting syntax error at onErrorResume(....). Below is the error I am getting:

Cannot resolve method 'onErrorResume(Class, )'

Below are the suggestions I get:

Candidates for method call this.graphQlClient.documentName("getDetails").variables(Map.of("xx", "xx")) .retrieve("data") .toEntity(Entity.class).onErrorResume(FieldAccessException.class, ex -> { }) are:

Mono onErrorResume(Function<? super Throwable, ? extends Mono<? extends TransactionEntity>>)

Mono onErrorResume(Class, Function<? super FieldAccessException, ? extends Mono<? extends TransactionEntity>>)

Mono onErrorResume(Predicate<? super Throwable>, Function<? super Throwable, ? extends Mono<? extends TransactionEntity>>)

Spring documention has the same code block given as example:

I would like to know how to fix this error? How to handle error using retrieve method ?

I want to handle error thrown from graphQL endpoint in an effective manner. Eventhough, we can use .execute() method to have more control on the GraphQL response, I wanted to use .retrieve() since it is provided in the library.

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-08-08 00:08 最后登录:2025-08-08 00:08
栏目列表
推荐内容