Skip to content

Commit

Permalink
Address ESLint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Aug 25, 2024
1 parent c881945 commit 7152e70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/connectionattributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@opentelemetry/semantic-conventions';
import type { Knex } from 'knex';

// eslint-disable-next-line sonarjs/function-return-type
function findAttribute(where: Record<string, unknown>, keys: string[]): AttributeValue | undefined {
for (const key of keys) {
const value = where[key];
Expand Down
7 changes: 4 additions & 3 deletions lib/knex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ export class KnexInstrumentation extends InstrumentationBase {
span.setStatus({ code: SpanStatusCode.OK }).end();
return result;
},
(e: Error) => {
span.recordException(e);
(e: unknown) => {
const err = e instanceof Error ? e : new Error(String(e), { cause: e });
span.recordException(err);
span.setStatus({ code: SpanStatusCode.ERROR }).end();
throw e;
throw err;
},
);
};
Expand Down
1 change: 1 addition & 0 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable sonarjs/no-nested-functions */
import { SpanStatusCode, context, trace } from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import { SEMATTRS_DB_NAME, SEMATTRS_DB_STATEMENT, SEMATTRS_DB_SYSTEM } from '@opentelemetry/semantic-conventions';
Expand Down

0 comments on commit 7152e70

Please sign in to comment.