Skip to content

Commit

Permalink
fix: missing breadcrumbs and data on native crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed May 28, 2024
1 parent 6b779f4 commit c555889
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 288 deletions.
54 changes: 53 additions & 1 deletion packages/sentry/scope.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
export {};
import { Scope } from '@sentry/core';
import type { Attachment, Breadcrumb, User } from '@sentry/types';
/**
* Extends the scope methods to set scope on the Native SDKs
*/
export declare class NativescriptScope extends Scope {
/**
* @inheritDoc
*/
setUser(user: User | null): this;
/**
* @inheritDoc
*/
setTag(key: string, value: string): this;
/**
* @inheritDoc
*/
setTags(tags: {
[key: string]: string;
}): this;
/**
* @inheritDoc
*/
setExtras(extras: {
[key: string]: any;
}): this;
/**
* @inheritDoc
*/
setExtra(key: string, extra: any): this;
/**
* @inheritDoc
*/
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
/**
* @inheritDoc
*/
clearBreadcrumbs(): this;
/**
* @inheritDoc
*/
setContext(key: string, context: {
[key: string]: any;
} | null): this;
/**
* @inheritDoc
*/
addAttachment(attachment: Attachment): this;
/**
* @inheritDoc
*/
clearAttachments(): this;
}
179 changes: 89 additions & 90 deletions packages/sentry/scope.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion packages/sentry/wrapper.android.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Envelope } from '@sentry/types';
import { Breadcrumb, Envelope, User } from '@sentry/types';
import { NativescriptOptions } from './options';
export declare namespace NATIVE {
function isNativeTransportAvailable(): boolean;
Expand Down Expand Up @@ -35,4 +35,12 @@ export declare namespace NATIVE {
isColdStart: java.lang.Boolean;
didFetchAppStart: boolean;
}>;
function setUser(user: User | null, otherUserKeys: any): void;
function setTag(key: string, value: string): void;
function setExtra(key: string, extra: any): void;
function addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): void;
function clearBreadcrumbs(): void;
function setContext(key: string, context: {
[key: string]: any;
} | null): void;
}
4 changes: 1 addition & 3 deletions src/sentry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export {
setContext,
setExtra,
setExtras,
withScope,
configureScope,
setTag,
setTags,
setUser,
Expand All @@ -40,7 +38,7 @@ import { Trace } from '@nativescript/core';
export { NativescriptOptions } from './options';
export { NativescriptClient } from './client';

export { init, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback } from './sdk';
export { configureScope, init, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback , withScope} from './sdk';
// export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';

export {
Expand Down
Loading

0 comments on commit c555889

Please sign in to comment.