refactor: unDRY PGRST prefix in errors for better search/grep
This commit is contained in:
+38
-37
@@ -654,44 +654,45 @@ instance JSON.ToJSON ErrorCode where
|
|||||||
-- New group of errors will be added at the end of all the groups and will have the next prefix in the sequence
|
-- New group of errors will be added at the end of all the groups and will have the next prefix in the sequence
|
||||||
-- New errors are added at the end of the group they belong to and will have the next code in the sequence
|
-- New errors are added at the end of the group they belong to and will have the next code in the sequence
|
||||||
buildErrorCode :: ErrorCode -> Text
|
buildErrorCode :: ErrorCode -> Text
|
||||||
buildErrorCode code = "PGRST" <> case code of
|
buildErrorCode code = case code of
|
||||||
ConnectionErrorCode00 -> "000"
|
-- Keep the "PGRST" prefix in every code for an easier search/grep
|
||||||
ConnectionErrorCode01 -> "001"
|
ConnectionErrorCode00 -> "PGRST000"
|
||||||
ConnectionErrorCode02 -> "002"
|
ConnectionErrorCode01 -> "PGRST001"
|
||||||
ConnectionErrorCode03 -> "003"
|
ConnectionErrorCode02 -> "PGRST002"
|
||||||
|
ConnectionErrorCode03 -> "PGRST003"
|
||||||
|
|
||||||
ApiRequestErrorCode00 -> "100"
|
ApiRequestErrorCode00 -> "PGRST100"
|
||||||
ApiRequestErrorCode01 -> "101"
|
ApiRequestErrorCode01 -> "PGRST101"
|
||||||
ApiRequestErrorCode02 -> "102"
|
ApiRequestErrorCode02 -> "PGRST102"
|
||||||
ApiRequestErrorCode03 -> "103"
|
ApiRequestErrorCode03 -> "PGRST103"
|
||||||
ApiRequestErrorCode05 -> "105"
|
ApiRequestErrorCode05 -> "PGRST105"
|
||||||
ApiRequestErrorCode06 -> "106"
|
ApiRequestErrorCode06 -> "PGRST106"
|
||||||
ApiRequestErrorCode07 -> "107"
|
ApiRequestErrorCode07 -> "PGRST107"
|
||||||
ApiRequestErrorCode08 -> "108"
|
ApiRequestErrorCode08 -> "PGRST108"
|
||||||
ApiRequestErrorCode09 -> "109"
|
ApiRequestErrorCode09 -> "PGRST109"
|
||||||
ApiRequestErrorCode10 -> "110"
|
ApiRequestErrorCode10 -> "PGRST110"
|
||||||
ApiRequestErrorCode11 -> "111"
|
ApiRequestErrorCode11 -> "PGRST111"
|
||||||
ApiRequestErrorCode12 -> "112"
|
ApiRequestErrorCode12 -> "PGRST112"
|
||||||
ApiRequestErrorCode14 -> "114"
|
ApiRequestErrorCode14 -> "PGRST114"
|
||||||
ApiRequestErrorCode15 -> "115"
|
ApiRequestErrorCode15 -> "PGRST115"
|
||||||
ApiRequestErrorCode16 -> "116"
|
ApiRequestErrorCode16 -> "PGRST116"
|
||||||
ApiRequestErrorCode17 -> "117"
|
ApiRequestErrorCode17 -> "PGRST117"
|
||||||
ApiRequestErrorCode18 -> "118"
|
ApiRequestErrorCode18 -> "PGRST118"
|
||||||
ApiRequestErrorCode19 -> "119"
|
ApiRequestErrorCode19 -> "PGRST119"
|
||||||
ApiRequestErrorCode20 -> "120"
|
ApiRequestErrorCode20 -> "PGRST120"
|
||||||
ApiRequestErrorCode21 -> "121"
|
ApiRequestErrorCode21 -> "PGRST121"
|
||||||
ApiRequestErrorCode22 -> "122"
|
ApiRequestErrorCode22 -> "PGRST122"
|
||||||
ApiRequestErrorCode23 -> "123"
|
ApiRequestErrorCode23 -> "PGRST123"
|
||||||
ApiRequestErrorCode24 -> "124"
|
ApiRequestErrorCode24 -> "PGRST124"
|
||||||
|
|
||||||
SchemaCacheErrorCode00 -> "200"
|
SchemaCacheErrorCode00 -> "PGRST200"
|
||||||
SchemaCacheErrorCode01 -> "201"
|
SchemaCacheErrorCode01 -> "PGRST201"
|
||||||
SchemaCacheErrorCode02 -> "202"
|
SchemaCacheErrorCode02 -> "PGRST202"
|
||||||
SchemaCacheErrorCode03 -> "203"
|
SchemaCacheErrorCode03 -> "PGRST203"
|
||||||
SchemaCacheErrorCode04 -> "204"
|
SchemaCacheErrorCode04 -> "PGRST204"
|
||||||
|
|
||||||
JWTErrorCode00 -> "300"
|
JWTErrorCode00 -> "PGRST300"
|
||||||
JWTErrorCode01 -> "301"
|
JWTErrorCode01 -> "PGRST301"
|
||||||
JWTErrorCode02 -> "302"
|
JWTErrorCode02 -> "PGRST302"
|
||||||
|
|
||||||
InternalErrorCode00 -> "X00"
|
InternalErrorCode00 -> "PGRSTX00"
|
||||||
|
|||||||
Reference in New Issue
Block a user