paascloud/paascloud-master · error · MdcBizException
MDC10021002
MDC10021002
Error message
MDC10021002
What it means
MDC10021002 is thrown by MdcAddressServiceImpl.getAddressById when the Feign response wrapper from mdcAddressQueryFeignApi.getById reports an error (wrapper.error() is true). It signals that the remote address-lookup service returned a failure rather than a valid AddressDTO. It is a downstream/response-error condition, distinct from the null-wrapper (GL99990002) case.
Solutions
- Check the downstream mdc address service logs for the underlying error returned in the Wrapper
- Verify the addressId exists in the mdc_address table before calling
- Confirm Feign endpoints and service registration for mdcAddressQueryFeignApi are correct
- Add a fallback/default address when the wrapper is an error
Example fix
// before
Wrapper<AddressDTO> wrapper = mdcAddressQueryFeignApi.getById(addressId);
if (wrapper.error()) {
throw new MdcBizException(ErrorCodeEnum.MDC10021002);
}
// after
Wrapper<AddressDTO> wrapper = mdcAddressQueryFeignApi.getById(addressId);
if (wrapper == null || wrapper.error()) {
logger.warn("address lookup failed for id={}, falling back", addressId);
return defaultAddress();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (addressId == null || addressId <= 0) { throw new IllegalArgumentException("addressId required"); } Type guard
boolean isValid = wrapper != null && !wrapper.error() && wrapper.getResult() != null;
Try / catch
try { Wrapper<AddressDTO> w = mdcAddressQueryFeignApi.getById(id); if (w == null || w.error()) throw new MdcBizException(ErrorCodeEnum.MDC10021002); return w.getResult(); } catch (MdcBizException e) { logger.warn("address lookup failed: {}", e.getMessage()); return defaultAddress(); } Prevention
- Validate the address id before the RPC
- Log the Wrapper error code/message to expose the downstream cause
- Provide a fallback address for degraded mode
When it happens
Trigger: Calling getAddressById(addressId) when the remote mdc address service responds with an error status inside the Wrapper (e.g. the addressId does not resolve, or the remote service returns its own business-error envelope).
Common situations: Address service is degraded or misconfigured downstream; caller passes an addressId that the remote service cannot resolve; Feign circuitry returns an error wrapper during partial outages.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/932b4cc5588edb64.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/MdcAddressServiceImpl.java:36
* @author paascloud.net @gmail.com
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class MdcAddressServiceImpl implements MdcAddressService {
@Resource
private MdcAddressQueryFeignApi mdcAddressQueryFeignApi;
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public AddressDTO getAddressById(Long addressId) {
Preconditions.checkArgument(addressId != null, "地址ID不能为空");
Wrapper<AddressDTO> wrapper = mdcAddressQueryFeignApi.getById(addressId);
if (wrapper == null) {
throw new MdcBizException(ErrorCodeEnum.GL99990002);
}
if (wrapper.error()) {
throw new MdcBizException(ErrorCodeEnum.MDC10021002);
}
return wrapper.getResult();
}
}
View on GitHub (pinned to 781281a950)