{"record":{"id":"6ca74739ada78056","repo":"paascloud/paascloud-master","slug":"gl99990002","errorCode":"GL99990002","errorMessage":"GL99990002","messagePattern":"GL99990002","errorType":"error_code","errorClass":"MdcBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-omc/src/main/java/com/paascloud/provider/service/impl/MdcProductServiceImpl.java","lineNumber":91,"sourceCode":"\n\t@Override\n\tpublic int updateProductStockById(ProductDto productDto) {\n\t\tPreconditions.checkArgument(productDto.getId() != null, ErrorCodeEnum.MDC10021021.msg());\n\t\tWrapper<Integer> wrapper = mdcProductFeignApi.updateProductStockById(productDto);\n\t\tif (wrapper == null) {\n\t\t\tthrow new MdcBizException(ErrorCodeEnum.GL99990002);\n\t\t}\n\t\tif (wrapper.error()) {\n\t\t\tthrow new MdcBizException(ErrorCodeEnum.MDC10021022, productDto.getId());\n\t\t}\n\t\treturn wrapper.getResult();\n\t}\n\n\t@Override\n\tpublic String getMainImage(final Long productId) {\n\t\tWrapper<String> wrapper = mdcProductFeignApi.getMainImage(productId);\n\t\tif (wrapper == null) {\n\t\t\tthrow new MdcBizException(ErrorCodeEnum.GL99990002);\n\t\t}\n\t\treturn wrapper.getResult();\n\t}\n}\n","sourceCodeStart":73,"sourceCodeEnd":96,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-omc/src/main/java/com/paascloud/provider/service/impl/MdcProductServiceImpl.java#L73-L96","documentation":"GL99990002 maps to ErrorCodeEnum GL99990002 (\"微服务不在线,或者网络超时\" — microservice offline or network timeout). getMainImage calls the MDC product service via the mdcProductFeignApi Feign client; if the Feign call returns null (the remote service is down, unregistered, or the call failed and the fallback/hystrix wrapper yielded no Wrapper), the method throws this MdcBizException instead of returning a result. It signals a downstream availability problem, not a bad product ID.","triggerScenarios":"Calling MdcProductServiceImpl.getMainImage(productId) when the paascloud-provider-mdc service is not registered in the registry (Eureka), is stopped/crashed, or the Feign call times out so the client returns a null Wrapper.","commonSituations":"MDC provider not started or crashed; wrong registry address in config; network partition or firewall between OMC and MDC services; Feign read/ribbon timeout too low under load; service still starting up when the call is made.","solutions":["Verify the paascloud-provider-mdc service is running and registered in the service registry (check Eureka/registry console and its health endpoint).","Check network connectivity and any firewall between the OMC service and the MDC service; confirm the registry address in config is correct.","Increase Feign/Ribbon timeouts (feign.client.config.default.readTimeout, ribbon.ReadTimeout) if the MDC call is slow.","Add retry or a fallback (e.g. return a default image URL) instead of failing the whole request when the MDC service is temporarily unavailable.","Re-run the call after confirming the MDC service has finished starting."],"exampleFix":"// before\nWrapper<String> wrapper = mdcProductFeignApi.getMainImage(productId);\nif (wrapper == null) {\n    throw new MdcBizException(ErrorCodeEnum.GL99990002);\n}\nreturn wrapper.getResult();\n// after\nWrapper<String> wrapper = mdcProductFeignApi.getMainImage(productId);\nif (wrapper == null || PublicUtil.isEmpty(wrapper.getResult())) {\n    logger.warn(\"主图获取失败, 使用默认图, productId={}\", productId);\n    return DEFAULT_MAIN_IMAGE;\n}\nreturn wrapper.getResult();","handlingStrategy":"try-catch","validationCode":"// caller-side pre-check: ensure the MDC service is reachable before calling\nboolean mdcHealthy = restTemplateName.getForEntity(\"http://PAASCLOUD-PROVIDER-MDC/actuator/health\", String.class).getStatusCode().is2xxSuccessful();\nif (!mdcHealthy) { throw new IllegalStateException(\"MDC service is offline\"); }","typeGuard":"boolean hasResult(Wrapper<String> w) { return w != null && w.getResult() != null; }","tryCatchPattern":"try {\n    String mainImage = mdcProductService.getMainImage(productId);\n} catch (MdcBizException e) {\n    if (\"GL99990002\".equals(e.getMessage())) {\n        // downstream MDC offline/timeout: use default image or retry later\n    } else { throw e; }\n}","preventionTips":["Monitor MDC service registration/health in the registry and alert on downtime.","Set realistic Feign/Ribbon connect and read timeouts.","Add circuit-breaker fallbacks (Hystrix/Sentinel) that degrade gracefully instead of throwing.","Retry idempotent reads with backoff during service restarts."],"tags":["feign","microservices","rpc-timeout","service-discovery","java"],"backgroundTag":"upstream-api-error","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}