Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use 4.0.0 #89

Merged
merged 22 commits into from
Jul 16, 2018
Merged

feat: Use 4.0.0 #89

merged 22 commits into from
Jul 16, 2018

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Jul 2, 2018

This PR uses the 4.0.0-beta.x packages internally now which mostly causes internal refactorings/rewrites.
There is a breaking change with context/scope handling which is documented in the changelog / docs.

On uncaughtException if not in prod we show the dialog the same way as electron does, if in prod we exit the app if the user does not overwrite this behavior with onFatalError option.

@HazAT HazAT self-assigned this Jul 2, 2018
@HazAT HazAT requested a review from jan-auer as a code owner July 2, 2018 08:19
@HazAT HazAT changed the title [WIP] feat: Use 4.0.0 feat: Use 4.0.0 Jul 9, 2018
@HazAT HazAT requested a review from timfish July 9, 2018 14:39
src/common.ts Outdated
@@ -10,7 +10,7 @@ export const IPC_EVENT = 'sentry-electron.event';
/** IPC to capture a breadcrumb globally. */
export const IPC_CRUMB = 'sentry-electron.breadcrumbs';
/** IPC to capture new context (user, tags, extra) globally. */
Copy link
Member Author

@HazAT HazAT Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc comment wrong

*/
export async function isAppReady(): Promise<boolean> {
return app.isReady()
? Promise.resolve(true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Write true

@HazAT
Copy link
Member Author

HazAT commented Jul 13, 2018

@timfish Could you please do the last pass over it whenever you have time?
I already reviewed it with @jan-auer and it should be fine.

@@ -65,7 +65,7 @@ function getRendererExtra(
*/
export async function isAppReady(): Promise<boolean> {
return app.isReady()
? Promise.resolve(true)
? true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: app.isReady() || new Promise(...);

// tslint:enable:no-unsafe-any
const currentCloned = Scope.clone(getDefaultHub().getScope());
const fetchedScope = this.scopeStore.get();
(fetchedScope as any).eventProcessors = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit fishy. The stored scope should never have eventProcessors. It might be more defensive to remove the eventProcessors when setting into the store instead of when fetching it...

// The culprit has been deprecated about two years ago and can safely be
// removed. Remove this line, once this has been resolved in Raven.
delete (event as { culprit: string }).culprit;
delete (copy as { culprit: string }).culprit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary anymore with the new Node SDK?

public constructor(frontend: Frontend<ElectronOptions>) {
this.frontend = frontend;
this.inner = new NodeBackend(frontend);
public constructor(private readonly options: ElectronOptions) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This is the only time we declare fields like this.

): Promise<void> {
event.tags = { event_type: 'native', ...event.tags };
await this.processEvent(
event,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: In future refactoring, consider: { ...event, tags: { event_type: 'native', ...event.tags } }

@timfish
Copy link
Collaborator

timfish commented Jul 14, 2018

I'll take a look and test this with our app on Monday

const nodeClient = getDefaultHub().getClient() as NodeClient;
await nodeClient.captureException(error, getDefaultHub().getScope());

if (process.env.NODE_ENV !== 'production') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this logic. When an app is packaged and run on a users machine, NODE_ENV will usually be undefined.

In the main process, you can detect if the app is packaged via:

process.defaultApp === undefined

Many will also want a way to not display the dialog in development as its
a) too narrow to properly display stack traces
b) you can't copy and paste from the dialog

@HazAT HazAT merged commit b91a679 into master Jul 16, 2018
@HazAT HazAT deleted the feature/use-4.0.0 branch July 16, 2018 11:14
export function specificInit(options: ElectronOptions): void {
process.type === 'browser'
? module.require('./main').init(options)
: require('./renderer').init(options);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this logic backwards? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants