1.0.13 • Published 2 years ago

@twe_apollo/error-helper v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

About The Project

This library is an error handling library that the TRT World engineering team can use in their projects. This library is designed to help both clients and developers quickly understand errors encountered in the code, and it includes custom error codes for this purpose.

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

If this is a brand new project, make sure to create a package.json first with the npm init command.

This library is a private library, and before downloading it, you should perform the npm login process.

npm login

npm login

Installation is done using the npm install command:

npm i @twe_apollo/error-helper

Error List

ERROR CODEERROR MESSAGEERROR PREFIXERROR DESCRIPTION
0Undefined errorUNDEFINED_ERRORWe can use this error when I couldn't find related error
1Health check errorHEALTH_CHECK_ERRORThis error occurs if there is an error during health check
2Worker errorsWORKER_ERRORThis error occurs if there is an error in the worker
3Worker listener errorsWORKER_LISTENER_ERRORThis error occurs if there is an error in worker listener
4API settings errorsAPI_SETTING_ERRORThis error occurs if there is an error in API settings
1000User register errorUSER_REGISTER_ERRORThis error occurs if the registration of a user fails
1001User login errorUSER_LOGIN_ERRORThis error occurs if the login of a user fails
1002User logout errorUSER_LOGOUT_ERRORThis error occurs if the logout of a user fails
1003User reset password errorUSER_RESET_PASSWORD_ERRORThis error occurs if resetting a user's password fails
1004User create new password errorUSER_CREATE_NEW_PASSWORD_ERRORThis error occurs if creating a new password for a user fails
1005Seed create user errorSEED_CREATE_USER_ERRORThis error occurs if creating users as seed fails
1006Seed create config errorSEED_CREATE_CONFIG_ERRORThis error occurs if creating config as seed fails
2000There is no connection stringDATABASE_CONNECTION_STRING_NOT_FOUNDThis error occurs if there is no connection string
2001Database connection failedDATABASE_CONNECTION_ERRORThis error occurs if the server couldn't connect to the database
2002Failed to insert data into the databaseDATABASE_INSERT_ERRORThis error occurs if inserting data into the database fails
2003Failed to update data in the databaseDATABASE_UPDATE_ERRORThis error occurs if updating data in the database fails
2004Failed to delete data from the databaseDATABASE_DELETE_ERRORThis error occurs if deleting data from the database fails
2005The requested record was not found.DATABASE_RECORD_NOT_FOUNDThis error occurs if the requested record was not found
2006Permission denied for this operationDATABASE_PERMISSION_DENIEDThis error occurs if permission is denied for this operation
2007An unknown database error occurred.DATABASE_UNKNOWN_ERRORThis error occurs if an unknown database error occurs
2008Failed to get data from the databaseDATABASE_FIND_ERRORThis error occurs if getting data from the database fails
3000Failed to add task to queueQUEUE_TASK_INSERT_ERRORThis error occurs if adding a task to the queue fails
3001Failed to restart the queueQUEUE_RESTART_ERRORThis error occurs if restarting the queue fails
3002Failed to stop the queueQUEUE_STOP_ERRORThis error occurs if stopping the queue fails
3003Failed to pause the queueQUEUE_PAUSE_ERRORThis error occurs if pausing the queue fails
3004Failed to read all queuesQUEUE_READ_ERRORThis error occurs if reading all queues fails
3005Failed to get all cronjobsQUEUE_CRONJOB_GET_ERRORThis error occurs if getting all cronjobs fails
3006Failed to restart cronjobQUEUE_CRONJOB_RESTART_ERRORThis error occurs if restarting a cronjob fails
3007Failed to stop cronjobQUEUE_CRONJOB_STOP_ERRORThis error occurs if stopping a cronjob fails
3008Failed to get config errorQUEUE_SERVICE_GET_CONFIG_ERRORThis error occurs if getting config from message API fails
4000Failed to create a data in internal serviceSERVICE_INTERNAL_CREATE_DATA_ERRORThis error occurs if creating a data in an internal service fails
4001Failed to get data from an internal serviceSERVICE_INTERNAL_GET_DATA_ERRORThis error occurs if getting a data from an internal service fails
4002Failed to update a data in internal serviceSERVICE_INTERNAL_UPDATE_ERRORThis error occurs if updating a data in an internal service fails
4003Failed to delete a data in internal serviceSERVICE_INTERNAL_DELETE_ERRORThis error occurs if deleting a data from an internal service fails
4004Failed to send data to an internal serviceSERVICE_INTERNAL_SEND_DATA_ERRORThis error occurs if sending data to an internal service fails
4005Failed to send a task to an internal serviceSERVICE_INTERNAL_SEND_TASK_ERRORThis error occurs if sending a task to an internal service fails
4100Failed to create a data in external serviceSERVICE_EXTERNAL_CREATE_DATA_ERRORThis error occurs if creating a data in an external service fails
4101Failed to get data from an external serviceSERVICE_EXTERNAL_GET_DATA_ERRORThis error occurs if getting a data from an external service fails
4102Failed to update a data in external serviceSERVICE_EXTERNAL_UPDATE_ERRORThis error occurs if updating a data in an external service fails
4103Failed to delete a data in external serviceSERVICE_EXTERNAL_DELETE_ERRORThis error occurs if deleting a data from an external service fails
4104Failed to send data to an external serviceSERVICE_EXTERNAL_SEND_DATA_ERRORThis error occurs if sending data to an external service fails
4105Failed to send a task to an external serviceSERVICE_EXTERNAL_SEND_TASK_ERRORThis error occurs if sending a task to an external service fails

Quick Start

import { TWE_Error, TWE_Error_Prefix } from "@twe_apollo/error-helper";

export const create = async (data: ITodo): Promise<ITodo> => {
  try {
    const todo = await todoModel.create(data);
    return todo;
  } catch (error) {
    throw new TWE_Error(TWE_Error_Prefix.DATABASE_INSERT_FAILED, `${error}`);
  }
};

Contact

  • Murat Demirci - @muratdemirci - muratdemirci@trtworld.com
  • Ahmet Can Turan - @ahmtcntrn - ahmetcan.turan@trtworld.com
  • Abdullah Obaid - @abdullahOB - abdullah.obaid@trtworld.com
1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago