Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This document describes how to construct Error codes for all operations?

Background

Jira Issues

https://project-sunbird.atlassian.net/browse/SB-21578

Examples Of Error code

Code Block
PFT_CCRT10  >> PBK_CCRT10  >> DMW_CCRT10  >> NBB_CCRT10 

TraceId: 1234 
Error happened at NodeBB end. 
NBB_CCRT10 << NBB_CCRT10  << NBB_CCRT10 << NBB_CCRT10 

===> Servies: 
Discussion Middleware service -> DMW 
NodeBB Sercie -> NBB 

===> Operations: 
Category create - CCRT 
Topic create    - TCRT 
Group create    - GCRT 
Usr create      - UCRT 

===> ERROR CODES: 
01 - Category creation failed because of reason 1? 
02 - Category create failed because of reason 2? 
03 - Category update failed because of reason 1? 
04 - Category update failed because of reason 2? 
... 
DMW_CCRT01 
NBB_GCRT{error_code}

Problem Statement:

...

API

...

UNIQUE ERROR CODE

...

ERROR CODE

...

How to assign specific error code to api?

Solution:

API

Unique Operation Name

Operation Name

Error Number

Error Description

Error Code

FORUM API's






/forum/v2/read

DMW_FRED

DMW_FRED

01:

Forum read failed because plugin not enabled.


DMW_FRED01

/forum/v2/create

DMW_FCRT

DMW_FCRT

02:

Forum create failed because plugin not enabled.

DMW_FCRT02

Tags API






/tags

DMW_TRED

DMW_TRED

03:

Tags read failed

DMW_TRED03

USER DETAILS API's






/user/:userslug

DMW_URED

DMW_URED

04:

User details read failed

DMW_URED04

/user/:userslug/upvoted

DMW_UUVR

DMW_URED

05

User up vote post details read failed

DMW_URED05

/user/:userslug/downvoted

DMW_UDVR

DMW_URED

06

User down vote post details read failed

DMW_URED06

/user/:userslug/bookmarks

DMW_UBMR

DMW_URED

07:

User saved post details read failed

DMW_URED07

/user/v1/create

DMW_UCRT

DMW_UCRT

08:

Create user failed

DMW_UCRT08

CATEGORY API's






/category/:category_id/:slug

DMW_CDTL

DMW_CRED

09:

Category details read failed.

DMW_CRED09

/category/:cid

DMW_CRED

DMW_CRED




/categories

DMW_CLST

DMW_CRED

10:

Access list of categories failed.

DMW_CRED10

/v2/categories

DMW_CCRT

DMW_CCRT

11:

Create category failed

DMW_CCRT11

/v2/categories/:cid(PUT)

DMW_CUDT

DMW_CUDT

12:

Update category failed

DMW_CUDT12

/v2/categories/:cid(DELETE)

DMW_CDEL

DMW_CDEL

13:

Delete category failed

DMW_CDEL13

TOPICS API's






/unread

DMW_TUNR

DMW_TRED

14:

Access unread topics failed

DMW_TRED14

/recent

DMW_TRCT

DMW_TRED

15:

Access recent topics failed.

DMW_TRED15

/topic/:topic_id/:slug

DMW_TDTL

DMW_TRED

16:

Access topic details failed 

DMW_TRED16

/v2/topics

DMW_TCRT

DMW_TCRT

17:

Create topic  failed

DMW_TCRT17

/v2/topics/:tid(POST)

DMW_RCRT

DMW_RCRT

18:

Add reply failed

DMW_RCRT18

/v2/topics/:tid(PUT)

DMW_TUDT

DMW_TUDT

19:

Update topics/reply failed

DMW_TUDT19

/v2/topics/:tid(DELETE)

DMW_TDEL

DMW_TDEL

20:

Delete topic/reply failed

DMW_TDEL20

POST API's






/post/pid/:pid

DWM_PRED

DWM_PRED

21:

Access post details failed

DWM_PRED21

/v2/posts/:pid(POST)

DMW_PCRT

DMW_PCRT

22:

Create post failed

DMW_PCRT22

/v2/posts/:pid(DELETE)

DWM_PDEL

DWM_PDEL

23:

Delete post failed

DWM_PDEL23

/v2/posts/:pid/vote(POST)

DMW_PVOT

DMW_PCRT

24:

Adding vote to a post failed

DMW_PCRT24

/v2/posts/:pid/vote(DELETE)

DMW_PVDL

DMW_PCRT

25:

Deleting vote failed

DMW_PCRT25

/v2/posts/:pid/bookmark(POST)

DMW_PSVE

DMW_PCRT

26:

Bookmark post failed

DMW_PCRT26

/v2/posts/:pid/bookmark(DELETE)

DMW_PUSVE

DMW_PCRT

27:

Delete bookmark failed

DMW_PCRT27