Skip to content

Status Code and Error Code

Jack Hsieh edited this page May 27, 2019 · 15 revisions

Status Code

  • 200 成功。
  • 204 成功且不回覆內容,用於回覆 cross site access 的 OPTIONS request,以及 DELETE request。

Error Code

  • 400 表單驗證失敗,前端必須在發送前驗證使用者的輸入,後端返回訊息僅供開發使用。
  • 401 未登入,前端可顯示需登入提示或直接轉跳到 oauthUrl 進行登入。
  • 403 已登入,但仍然沒有權限,如存取自己沒有權限的計畫,或用計畫執行者權限編輯常見物種...等。
  • 404 找不到,網址錯誤或資源不存在。
  • 500 後端發生錯誤。

API - 錯誤訊息及前端處理

FV (form validated): 表示應由前端表單驗證才送出,故不應在前端收到此錯誤。
WR (wait for reviewing): 表示顯示的訊息內容正在等待確認。

File Status Code Message Frontend
tasks/media-worker.js:152: 400
tasks/media-worker.js:155: 400
tasks/media-worker.js:158: 400
tasks/media-worker.js:161: 400
tasks/media-worker.js:269: 400
handlers/species-handler.js:19: 400 errorMessage
handlers/species-handler.js:45: 400 errorMessage
handlers/species-handler.js:84: 400
handlers/species-handler.js:91: 400 errorMessage
handlers/species-handler.js:94: 400 'Title is required FV 物種名稱為必填
handlers/species-handler.js:105: 400 ${form.title['zh-TW']} is duplicate. 儲存時發生錯誤,請回報給系統管理員
handlers/species-handler.js:135: 400 ${form.title['zh-TW']} is duplicate. 儲存時發生錯誤,請回報給系統管理員
handlers/species-handler.js:145: 400 Missing ${projectSpecies.species._id}. 缺 species id
handlers/species-handler.js:155: 400 Can't find species ${form.id}. 找不到該物種
handlers/account-handler.js:39: 400 errorMessage
handlers/account-handler.js:47: 400 Some species are not found. 有些物種找不到
handlers/study-area-handler.js:175: 400 errorMessage
handlers/study-area-handler.js:195: 400 Can not add the three-tier study-area. FV 目前只允許樣區、子樣區兩層結構
handlers/notification-handler.js:19: 400 errorMessage
handlers/notification-handler.js:98: 400 errorMessage
handlers/project-area-handler.js:15: 400 errorMessage
handlers/project-handler.js:34: 400 errorMessage
handlers/project-handler.js:85: 400 errorMessage
handlers/project-handler.js:108: 400 'The cover image file is not found. 找不到封面影像
handlers/project-handler.js:170: 400 errorMessage
handlers/project-handler.js:200: 400 'The cover image file is not found. 找不到封面影像
handlers/project-handler.js:203: 400 'Some data fields are not found. FV 有些欄位找不到
handlers/project-handler.js:210: 400
handlers/project-handler.js:236: 400 errorMessage
handlers/project-handler.js:239: 400 'user is required. FV 使用者帳號為必填
handlers/project-handler.js:263: 400 User ${user._id} is already exists. FV 此使用者已存在
handlers/project-handler.js:290: 400 'members: This field is required. FV 成員為必填欄位
handlers/project-handler.js:293: 400 Can't delete all members. FV 無法刪除所有成員
handlers/project-handler.js:299: 400 errorMessage
handlers/project-handler.js:303: 400 'Require at least one manager. FV 至少要有一位管理者
handlers/project-handler.js:325: 400
handlers/camera-location-handler.js:21: 400 errorMessage
handlers/camera-location-handler.js:65: 400 errorMessage
handlers/camera-location-handler.js:120: 400 errorMessage
handlers/camera-location-handler.js:159: 400 errorMessage
handlers/camera-location-handler.js:252: 400 'It already locked by others. FV 相機位置正由其他人編輯中
handlers/annotation-handler.js:34: 400 errorMessage
handlers/annotation-handler.js:37: 400
handlers/annotation-handler.js:102: 400 'Some data fields are not found. 有些欄位找不到
handlers/annotation-handler.js:134: 400
handlers/annotation-handler.js:155: 400
handlers/annotation-handler.js:392: 400 errorMessage
handlers/annotation-handler.js:446: 400
handlers/annotation-handler.js:451: 400 ${field.dataField} is duplicate. 欄位重覆
handlers/annotation-handler.js:521: 400 errorMessage
handlers/annotation-handler.js:524: 400 'The camera location is required. FV 相機位置為必填
handlers/annotation-handler.js:527: 400 'The filename is required. FV 檔名為必填
handlers/annotation-handler.js:530: 400 'The time is required. FV 時間為必填
handlers/annotation-handler.js:545: 400 'Not found the camera location. 相機位置找不到
handlers/annotation-handler.js:548: 400
handlers/annotation-handler.js:562: 400 'Not found the file. 檔案找不到
handlers/annotation-handler.js:565: 400
handlers/annotation-handler.js:605: 400
handlers/annotation-handler.js:610: 400 ${field.dataField} is duplicate. 欄位重覆
handlers/file-handler.js
handlers/file-handler.js:66: 400 errorMessage
handlers/file-handler.js:71: 400 The field lastModified is required. FV & WR 檔案的最後更新時間資訊為必要
handlers/file-handler.js:78: 400 The cameraLocation is required. FV 相機位置為必填
handlers/file-handler.js:100: 400 Missing the file. 檔案找不到
handlers/file-handler.js:102: 400 Just allow zip files. FV 只接受 ZIP 檔案
handlers/file-handler.js:107: 400 Just allow csv files. FV 只接受 CSV 檔案
handlers/file-handler.js:111: 400 Just allow jpg, png files. FV & WR 只接受 JPG 或 PNG 的影像檔案
handlers/file-handler.js:114: 400 Just allow jpg, png files. FV & WR 只接受 JPG 或 PNG 的影像檔案
handlers/file-handler.js:117: 400 Just allow avi, m4v, mov, mp4 files. FV & WR 只接受 AVI, M4V, MOV 或 MP4 的影片檔案
handlers/file-handler.js:120: 400 Just allow zip files. FV & RW 只接受 ZIP 的壓縮檔案
handlers/file-handler.js:123: 400 Just allow csv files. FV & RW 只接受 CSV 的文字檔案
handlers/file-handler.js:126: 400 Just allow csv, tsv, tab, txt, xls, xlsx, jpg, png, mp4, avi, mov, mpg, mpeg files. FV & RW 只接受 CSV, TSV, TAB, TXT, XLS, XLSX, JPG, PNG, MP4, AVI, MOV, MPG 或 MPEG 的檔案
handlers/file-handler.js:170: 400 The camera location ${form.cameraLocation} is not found. WR 相機位置 ${form.cameraLocation} 找不到
handlers/file-handler.js:177: 404 Study area is not found. WR 樣區找不到
handlers/file-handler.js:180: 403 errorMessage
handlers/file-handler.js:235: 400
handlers/file-handler.js:240: 400 Can't get the time information in the exif. FV & WR 影像檔案的 EXIF 資訊為必要
FYI. exif-js / exif-js: JavaScript library for reading EXIF image metadat
handlers/file-handler.js:307: 400 errorMessage
handlers/file-handler.js:317: 400 Missing lastModified.
handlers/file-handler.js:317: 400 The type not allow.
handlers/file-handler.js:331: 400 Missing file.
handlers/file-handler.js:351: 400 Just allow jpg, png files. FV & WR 只接受 JPG 或 PNG 的影像檔案
handlers/file-handler.js:351: 400 Just allow avi, m4v, mov, mp4 files. FV & WR 只接受 AVI, M4V, MOV 或 MP4 的影片檔案
handlers/file-handler.js:368: 404 errorMessage
handlers/file-handler.js:368: 403 errorMessage
handlers/data-field-handler.js:21: 400 errorMessage
handlers/data-field-handler.js:27: 400
handlers/data-field-handler.js:62: 400 errorMessage
handlers/issue-handler.js:20: 400 errorMessage
handlers/issue-handler.js:27: 400 'The attachment file not found. 附件檔案遺失
handlers/annotation-revision-handler.js:17: 400 errorMessage
handlers/user-handler.js:16: 400 errorMessage
handlers/upload-session-handler.js:19: 400 errorMessage
handlers/upload-session-handler.js:82: 400
handlers/upload-session-handler.js:143: 400

上傳紀錄錯誤代碼

function Status Code Message Frontend
media-worker Missing required fields at row 1.
media-worker TypeError: Cannot read property 'getTime' of undefined
media-worker MongoError: E11000 duplicate key error collection: cameraTrap.Species index: TitleZhTW dup key: { : "頭烏線" }
media-worker Error: spawn /camera-trap-api/node_modules/dist-exiftool/node_modules/exiftool.pl/vendor/exiftool ENOENT
update-project-annotation-time untitled;undefined
media-worker Error: Invalid Closing Quote: got "2" at line 363 instead of delimiter, row delimiter, trimable character (if activated) or comment