首页 > 解决方案 > 能否在 IBM ODM 中自定义 HTTP 响应

问题描述

可以在 IBM ODM 中自定义 http 状态代码和消息吗?

我看到我们可以在 ODM 中进行异常处理,但消息会转到错误日志,我看不到自定义 http 响应和消息的方法(链接附加打击) https://www.ibm.com/support/knowledgecenter/SSQP76_8。 10.x/com.ibm.odm.dserver.rules.designer.run/shared_optimizing/tsk_excpt_custom.html

我的分析:

如果我错了,请纠正我

1) 使用 400 和 500 状态码自动处理技术异常,我看不到任何自定义方法

前任:

{
    "code": 500,
    "message": "An error occurred during the execution of the ruleset. Make sure that the request is valid, and review the ruleset and execution object model if applicable.",

}

{
    "code": 404,
    "message": "An error occurred during the initialization of the execution, make sure that the ruleset matches the execution requirements.",
    "details": "Cannot get the information about the ruleset /project/1.0/service/1.1. Make sure that you have deployed the ruleset and that the enable property is set correctly.\n",
    "errorCode": "GBRXH0501E"
} 

2)业务异常只能用Http响应200处理,创建额外的异常对象并在其中传递错误代码和消息

前任:

{
    "status": null,
    "Exception": {
        "code": 400,
        "message": state 'NJ' does not contain any business logic,
                 }

}

标签: rule-engineibm-odm

解决方案


推荐阅读