Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/nextjs/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ function makeWrappedHandlerGetter(origHandlerGetter: HandlerGetter): WrappedHand
* @returns A wrapped version of that logger
*/
function makeWrappedErrorLogger(origErrorLogger: ErrorLogger): WrappedErrorLogger {
return (err: Error): void => {
return function(this: Server, err: Error): void {
// TODO add context data here
Sentry.captureException(err);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return origErrorLogger.bind(this, err);
return origErrorLogger.call(this, err);
};
}
10 changes: 6 additions & 4 deletions packages/utils/src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { getFunctionName } from './stacktrace';
import { truncate } from './string';

/**
* Wrap a given object method with a higher-order function
* Replace a method in an object with a wrapped version of itself.
*
* @param source An object that contains a method to be wrapped.
* @param name A name of method to be wrapped.
* @param replacementFactory A function that should be used to wrap a given method, returning the wrapped method which
* will be substituted in for `source[name]`.
* @param name The name of the method to be wrapped.
* @param replacementFactory A higher-order function that takes the original version of the given method and returns a
* wrapped verstion. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to
* preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other
* args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.
* @returns void
*/
export function fill(source: { [key: string]: any }, name: string, replacementFactory: (...args: any[]) => any): void {
Expand Down