jupyter-naas / naas-models

GNU Affero General Public License v3.0
1 stars 0 forks source link

As a dev, I need to make sure error codes does not overlap in proto files #25

Open Dr0p42 opened 5 months ago

Dr0p42 commented 5 months ago

Issue Description

Problem

When defining error codes in proto files, there is a risk of overlapping codes which can lead to confusion and misinterpretation of error responses. This can be a critical issue, especially when handling HTTP status codes.

Solution

To prevent this issue, we need to establish and maintain a system or protocol for managing and assigning unique error codes across all our proto files. This system should ensure that each error code is distinct and clearly documented to prevent any ambiguity.

Action Items

By addressing this issue proactively, we can enhance the clarity and reliability of our error handling mechanisms within the project.

l-loic commented 5 months ago

What about something like this ? Or start at 1000 to avoid with http ? @Dr0p42

0001 : A
  - aimodel : 0001
      NO_ERROR = 0001;
      ALREADY_EXISTS = 0002;
      NOT_FOUND = 0003;
      NOT_UPDATED = 0004;
      NOT_AUTHORIZED = 0005;
      AIMODEL_OUT_OF_CREDITS = 0006;
      AIMODEL_DONT_HANDLE_COMPLETION = 0007;
  - asset : 0010
      ASSET_NO_ERROR = 0010;
      ASSET_NOT_FOUND = 0011;
      ASSET_ALREADY_EXISTS = 0012;
      ASSET_REQUEST_ERROR = 0013;
0050 : B
  - chat : 0050
      MESSAGE_NO_ERROR = 0050;
      MESSAGE_ALREADY_EXISTS = 0051;
      MESSAGE_NOT_FOUND = 0052;
      MESSAGE_NOT_UPDATED = 0053;
      MESSAGE_NOT_AUTHORIZED = 0054;
0100 : C
  - common : 0100
  - credit : 0101
0150 : D
0200 : E
0250 : F
0300 : G
0350 : H
0400 : I
  - iam : 0400
0450 : J
0500 : K
0550 : L
0600 : M
0650 : N
0700 : 0
0750 : P
0800 : Q
0850 : R
  - registry : 0850
      REGISTRY_ALREADY_EXISTS = 0850;
      REGISTRY_NOT_FOUND = 0851;
      NOT_AUTHORIZED = 0852;
0900 : S
  - secret : 0900
      SECRET_NO_ERROR = 0900;
      SECRET_ALREADY_EXISTS = 0901;
      SECRET_NOT_FOUND = 0902;
      SECRET_MARKED_FOR_DELETION = 0903;
  - space : 0910
      SPACE_NO_ERROR = 0910;
      SPACE_ALREADY_EXISTS = 0911;
      SPACE_NOT_FOUND = 0912;
      SPACE_NOT_UPDATED = 0913;
      SPACE_MUST_HAVE_ONE_CONTAINER_PORT = 0914;
  - storage : 0920
      STORAGE_NO_ERROR = 0920;
      STORAGE_ALREADY_EXIST = 0921;
      STORAGE_NOT_FOUND = 0922;
0950 : T
1000 : U
1050 : V
1100 : W
  - workspace : 1100
      WORKSPACE_NO_ERROR = 1100;
      WORKSPACE_NOT_FOUND = 1101;
      WORKSPACE_USER_ALREADY_EXISTS = 1102;
      WORKSPACE_USER_NOT_FOUND = 1103;
      WORKSPACE_USER_ALREADY_ACTIVE = 1104;
      USER_ALREADY_HAVE_PERSONAL_WORKSPACE = 1105;
      WORKSPACE_PLUGIN_NOT_FOUND = 1106;
1150 : X
1200 : Y
1250 : Z
INTERNAL_SERVER_ERROR = 9999;
FlorentLvr commented 4 months ago

@Dr0p42 , is it still a bug?