Skip to content

Commit

Permalink
fix: Updating dependencies and fixes (#144)
Browse files Browse the repository at this point in the history
* chore: updated dependencies

* chore: update to tslint-react 5.0.0

* fix: mixup between Request and RequestParams

* fix: convert Express Request to RequestParams

* fix: recreate package-lock to fix express dependency errors

* fix: test tap command update

* fix: test asserts

* refactor: use equal instead of ok
  • Loading branch information
miquelbeltran authored Apr 24, 2024
1 parent 5ea3a32 commit af925a2
Show file tree
Hide file tree
Showing 7 changed files with 5,695 additions and 4,195 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
yarn.lock

build/
.tap/
21 changes: 16 additions & 5 deletions lib/raygun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Raygun {
return this;
}

user(req?: Request): RawUserData | null {
user(req?: RequestParams): RawUserData | null {
return null;
}

Expand Down Expand Up @@ -189,7 +189,7 @@ class Raygun {
exception: Error | string,
customData?: CustomData,
callback?: (err: Error | null) => void,
request?: Request,
request?: RequestParams,
tags?: Tag[]
): Message {
const sendOptionsResult = this.buildSendOptions(
Expand Down Expand Up @@ -251,7 +251,7 @@ class Raygun {
exception: Error | string,
customData?: CustomData,
callback?: (err: Error | null) => void,
request?: Request,
request?: RequestParams,
tags?: Tag[]
): void {
const result = this.buildSendOptions(
Expand All @@ -276,7 +276,18 @@ class Raygun {
customData = this.expressCustomData;
}

this.send(err, customData || {}, function () {}, req, [
// Convert the Express Request to an object that can be sent to Raygun
const requestParams: RequestParams = {
hostname: req.hostname,
path: req.path,
method: req.method,
ip: req.ip ?? '',
query: req.query,
headers: req.headers,
body: req.body,
};

this.send(err, customData || {}, function () {}, requestParams, [
"UnhandledException",
]);
next(err);
Expand All @@ -293,7 +304,7 @@ class Raygun {
exception: Error | string,
customData?: CustomData,
callback?: Callback<IncomingMessage>,
request?: Request,
request?: RequestParams,
tags?: Tag[]
): SendOptionsResult {
let mergedTags: Tag[] = [];
Expand Down
Loading

0 comments on commit af925a2

Please sign in to comment.