---
# System prepended metadata

title: Edge365 error message
tags: [Edge365]

---

# Edge365 error message
---
## 1. Error Message
- Error message format
	```json
	{
		"errorCode": xxx,
		"message" : "=messages裡面的en-US的字串",
		"messages" : 
		{
			"en-US": "This is Message..."
		},
		"details" : 
		{
			"en-US": "開發者看的, 一般用戶看不懂的錯誤"
		},
		"specialKey" : "各APP自己訂的格式"
	}
	```
-	Example
	```json
	{
		"errorCode" : 500001,
		"messages" : 
		{
			"en-US": "remove org fail"
		}
		"detail": 
		{
			"en-US": "relation 'pgsrpschemaorginfoex' does not exist"
		}
	}
	```
- Language code列表
	```json
	"languages": [
        {
          "code": "en-US",
          "nativeName": "English",
          "__typename": "Language"
        },
        {
          "code": "zh-TW",
          "nativeName": "繁體中文",
          "__typename": "Language"
        },
        {
          "code": "zh-CN",
          "nativeName": "简体中文",
          "__typename": "Language"
        },
        {
          "code": "ja-JP",
          "nativeName": "日本語",
          "__typename": "Language"
        },
        {
          "code": "es-ES",
          "nativeName": "Español",
          "__typename": "Language"
        },
        {
          "code": "ko-KR",
          "nativeName": "한국어",
          "__typename": "Language"
        },
        {
          "code": "th-TH",
          "nativeName": "ไทย",
          "__typename": "Language"
        },
        {
          "code": "vi-VN",
          "nativeName": "Tiếng Việt",
          "__typename": "Language"
        },
        {
          "code": "ms-MY",
          "nativeName": "Melayu",
          "__typename": "Language"
        },
        {
          "code": "id-ID",
          "nativeName": "Indonesia.",
          "__typename": "Language"
        },
        {
          "code": "nl-NL",
          "nativeName": "Nederlands",
          "__typename": "Language"
        },
        {
          "code": "pt-PT",
          "nativeName": "Português",
          "__typename": "Language"
        },
        {
          "code": "fr-FR",
          "nativeName": "français",
          "__typename": "Language"
        },
        {
          "code": "de-DE",
          "nativeName": "Deutsche",
          "__typename": "Language"
        },
        {
          "code": "fi-FI",
          "nativeName": "Suomalainen",
          "__typename": "Language"
        },
        {
          "code": "da-DK",
          "nativeName": "dansk",
          "__typename": "Language"
        },
        {
          "code": "ru-RU",
          "nativeName": "русский",
          "__typename": "Language"
        },
        {
          "code": "it-IT",
          "nativeName": "italiano",
          "__typename": "Language"
        },
        {
          "code": "el-GR",
          "nativeName": "Ελληνικά",
          "__typename": "Language"
        }
      ]
		```
- UI
  - [Figma](https://www.figma.com/file/G5aiUXJbzcSBXh1XojRTgz/02-Object-Management?node-id=4594%3A84592&t=5ciFjHKQXoDYGShB-4)
  - Only display message
  	![](https://i.imgur.com/BvsdhMM.png)
  - Show details (還沒決定)
  	- 直接在相同位置展開, 需有字數上限300字元
  		![](https://i.imgur.com/GzACWdH.png)
	- 另開dialog呈現detail
			![](https://i.imgur.com/wsf6BRe.png)

## 2. Error code

### 2.1 4xx for data error

| Error code | Description                                   | Used by      |
| ---------- | --------------------------------------------- | ------------ |
| 400000     | Query is not acceptable                       | fwd          |
| 400001     | DB unique key violation (duplicated name/key) | fwd, profile |
| 400002     | DB foreign key violation                      | fwd          |
| 400003     | input target is not exist                     | fwd          |

### 2.2 5xx for system error

| Error code | Description      | Used by |
| ---------- | ---------------- | ------- |
| 500001     | unexcepted error | fwd     |
| 500002     | DB connect error | fwd     |

### 2.3 8xx for APP specific error

|                | **801xxx - api-Profile** |             |
| -------------- | ------------------------ | ----------- |
| **Error code** | **Description**          | **Used by** |
| 801001         | Un-used Share Code       | profile     |
| 801002         | Duplicated Share Code    | profile     |
| 801003         | Model not found          | profile     |
|                | **802xxx - ???**         |             |
| **Error code** | **Description**          | **Used by** |
| 802001         | ???                      | ???         |


## Discussion
- 如果cookie有帶language, 可以只回該language的錯誤訊息就好
- 找守哲討論看看能不能後台直接印apollo error message
	- Morris提供
		![](https://i.imgur.com/0PT49wS.png)

	- 
---
## 20230605

OK
```json
{
  "data": {
    "message" : "OK"
  },
  "latency": "200 ms"
  
}
```
Error
```json
{
  "error": {
    "code": 400,
    "message" : "ttagafg",
    "messages" : {
      "en-us" : "",
      "zh-cn" : ""
    },
    "status" : "Invalid xxx",
    "details": [
      {
        "type": "Error",
        "reason": "asdfasdfasdfasdfasdasdf"
      }
    ]
    
  },
  "latency": "200 ms"
}
```
---
###### tags: `Edge365`