Skip to content

Commit 983e858

Browse files
committed
cleanup
1 parent d635dcb commit 983e858

6 files changed

Lines changed: 9 additions & 77 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "klepper",
3+
"version": "0.0.1-alpha",
34
"author": "Piotr Szewczyk",
45
"description": "NodeJS library to catching exceptions.",
56
"license": "MIT",

packages/commons/src/global.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { KlepperGlobal } from "@klepper/transport";
22

3+
/**
4+
* Using internal NodeJS global object to persist information
5+
*
6+
* @returns {KlepperGlobal}
7+
*/
38
export const getGlobalClientData = (): KlepperGlobal => global.__KLEPPER__ || {};
49

510
export const setGlobalClientData = (data: KlepperGlobal): void => {

packages/node/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { StackFrame } from "stack-trace";
44
const prepareStackTraces = (stackFrames: StackFrame[]): Trace[] => {
55
const parseTraces = (frame: StackFrame): Trace => {
66
return {
7-
functionName: frame.getFunctionName(), //return absolut path, need to extract also function name
7+
functionName: frame.getFunctionName(),
88
rowNo: frame.getLineNumber(),
99
colNo: frame.getColumnNumber(),
1010
fileName: frame.getFileName(),

packages/node/src/index.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,4 @@
11
import * as Middleware from "./middlewares/index";
22
import * as Klepper from "./main";
33

4-
const environment = process.env.ENV;
5-
Klepper.connect({ privateKey: "" }, () => {
6-
if (environment === "prod") {
7-
return true;
8-
}
9-
return false;
10-
})
11-
124
export { Middleware, Klepper }
13-
14-
15-
/**
16-
* TODO:
17-
*
18-
* 1. captureException function which is placed in catch clause in code when we want to capture an error
19-
* 2. communication between library and server, send exceptions to server
20-
* 3. ENDING OF ERROR HANDLER, CREATE EXCEPTION OBJECT
21-
* 4. Get code from project where is the error, with using filename from error object
22-
*
23-
*/
24-
25-
/**
26-
* IDEAS:
27-
*
28-
* 1. add parameters of exceptions which client want to handle
29-
* 2.
30-
*/
31-
32-
/**
33-
* PROBLEMS:
34-
*
35-
* 1. do we need to capture also requests and not only exceptions?
36-
* 2. do we need to parse stack objects from exceptions and then send to server or we can send whole exception stack, name and description?
37-
*/

packages/node/src/middlewares/error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const isToCatch = (req: KlepperIncomingMessage, options?: ErrorMiddlewareOptions
7171
*
7272
* @param error
7373
*/
74-
const catchException = (error: KlepperError, req: KlepperIncomingMessage) => {
74+
export const catchException = (error: KlepperError, req: KlepperIncomingMessage) => {
7575
const { message, name } = error;
7676

7777
try {
@@ -92,6 +92,6 @@ const catchException = (error: KlepperError, req: KlepperIncomingMessage) => {
9292

9393
http.sendEvent(payload);
9494
} catch (error) {
95-
console.warn(`Cannot catch exception: ${error}`); //to better handling
95+
console.warn(`[Klepper] Cannot catch exception: ${error}`);
9696
}
9797
}

packages/node/src/middlewares/request.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)