Skip to content

polaris-java对外接口抛异常的行为优化 #167

@andrewshan

Description

@andrewshan

北极星当前接口抛出来的异常是RumtimeException,用户程序如果不进行catch的话,会导致接口失败。传递到上层线程就会失败。
因此,接口行为建议修改如下:

  1. 不是所有错误码都跑异常,只有出现SDK内部错误的情况,SDK出现没法运行的情况,才抛异常。
  2. reponse增加一个Code字段,给出对应的返回码

需要抛异常的情况:

  • 插件初始化失败:PLUGIN_ERROR
  • 配置错误,SDK初始化失败:INVALID_CONFIG
  • SDK已经销毁,状态错误:INVALID_STATE

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions