1.0.6 • Published 2 years ago
@twe_apollo/warden-trtworld-error-monitoring-client v1.0.6
About The Project
This library is an error monitoring library that the TRT World engineering team can use in their projects. It enables the recording and visualization of errors that occur in a project. It can also be used for loging.
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/warden-trtworld-error-monitoring-client
Quick Start
config.ts
import { WardenTrtWorld, ExceptionHandlers } from "@twe_apollo/warden-trtworld-error-monitoring-client";
const warden = new WardenTrtWorld(<your_warden_host>, <your_project_key>)
export { warden, ExceptionHandlers }
controller.ts
import { warden } from '../helpers/error-helper/warden/config'
export const create =async (req: Request, res: Response) => {
try {
// codes
} catch (error) {
const errorMessage = await warden.handleError(error as Error)
res.status(StatusCodes.NOT_FOUND).json({
ERROR: errorMessage
})
}
}
another features
import { warden, ExceptionHandlers } from "../helpers/error-helper/warden/config";
// using as loger
warden.trace.logger.log("your_log_text");
warden.trace.logger.info("your_log_text");
warden.trace.logger.warn("your_log_text");
warden.trace.logger.error("your_log_text");
warden.trace.logger.debug("your_log_text");
// Directly report errors -> ExceptionHandlers.catchException(error)
// This function directly sends the error information it receives to the warden client.
export const create =async (req: Request, res: Response) => {
try {
// codes
} catch (error) {
ExceptionHandlers.catchException(error as Error)
res.status(StatusCodes.NOT_FOUND).json({
ERROR:`${error}`
})
}
}
Warden Client
Contact
- Murat Demirci - @muratdemirci - muratdemirci@trtworld.com
- Ahmet Can Turan - @ahmtcntrn - ahmetcan.turan@trtworld.com
- Abdullah Obaid - @abdullahOB - abdullah.obaid@trtworld.com