Skip to content

Commit 2cc811d

Browse files
committed
fix(vue): options can be undefined in errorHandler
1 parent d4c153b commit 2cc811d

File tree

3 files changed

+425
-3
lines changed

3 files changed

+425
-3
lines changed

packages/vue/src/errorhandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export const attachErrorHandler = (app: Vue, options: Options): void => {
1717
trace,
1818
};
1919

20-
if (vm && options.attachProps) {
20+
if (options.attachProps && vm && (vm.$options?.propsData || vm.$props)) {
2121
// Vue2 - $options.propsData
2222
// Vue3 - $props
23-
metadata.propsData = vm.$options.propsData || vm.$props;
23+
metadata.propsData = vm.$options?.propsData || vm.$props;
2424
}
2525

2626
// Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.

packages/vue/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type ViewModel = {
1717
$root: ViewModel;
1818
$parent?: ViewModel;
1919
$props: { [key: string]: any };
20-
$options: {
20+
$options?: {
2121
name?: string;
2222
propsData?: { [key: string]: any };
2323
_componentTag?: string;

0 commit comments

Comments
 (0)