A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/commit/e38d0067521eee85febedc5f3ed3c24b5454c3a9 below:

improve template expression error message · vuejs/vue@e38d006 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+12

-8

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+12

-8

lines changed Original file line number Diff line number Diff line change

@@ -89,10 +89,14 @@ function checkExpression (exp: string, text: string, errors: Array<string>) {

89 89

if (keywordMatch) {

90 90

errors.push(

91 91

`avoid using JavaScript keyword as property name: ` +

92 -

`"${keywordMatch[0]}" in expression ${text.trim()}`

92 +

`"${keywordMatch[0]}"\n Raw expression: ${text.trim()}`

93 93

)

94 94

} else {

95 -

errors.push(`invalid expression: ${text.trim()}`)

95 +

errors.push(

96 +

`invalid expression: ${e.message} in\n\n` +

97 +

` ${exp}\n\n` +

98 +

` Raw expression: ${text.trim()}\n`

99 +

)

96 100

}

97 101

}

98 102

}

Original file line number Diff line number Diff line change

@@ -56,9 +56,9 @@ describe('Options template', () => {

56 56

template: '<div v-if="!@"><span>{{ a"" }}</span><span>{{ do + 1 }}</span></div>'

57 57

}).$mount()

58 58

expect('Error compiling template').toHaveBeenWarned()

59 -

expect('invalid expression: v-if="!@"').toHaveBeenWarned()

60 -

expect('invalid expression: {{ a"" }}').toHaveBeenWarned()

61 -

expect('avoid using JavaScript keyword as property name: "do" in expression {{ do + 1 }}').toHaveBeenWarned()

59 +

expect('Raw expression: v-if="!@"').toHaveBeenWarned()

60 +

expect('Raw expression: {{ a"" }}').toHaveBeenWarned()

61 +

expect('avoid using JavaScript keyword as property name: "do"').toHaveBeenWarned()

62 62

})

63 63 64 64

it('should not warn $ prefixed keywords', () => {

@@ -75,7 +75,7 @@ describe('Options template', () => {

75 75

expect('Error compiling template').toHaveBeenWarned()

76 76

expect('invalid v-for alias "1"').toHaveBeenWarned()

77 77

expect('invalid v-for iterator "2"').toHaveBeenWarned()

78 -

expect('invalid expression: v-for="(1, 2) in a----"').toHaveBeenWarned()

78 +

expect('Raw expression: v-for="(1, 2) in a----"').toHaveBeenWarned()

79 79

})

80 80 81 81

it('warn error in generated function (v-on)', () => {

Original file line number Diff line number Diff line change

@@ -122,7 +122,7 @@ describe('compile options', () => {

122 122 123 123

compiled = compile('<div v-if="a----">{{ b++++ }}</div>')

124 124

expect(compiled.errors.length).toBe(2)

125 -

expect(compiled.errors[0]).toContain('invalid expression: v-if="a----"')

126 -

expect(compiled.errors[1]).toContain('invalid expression: {{ b++++ }}')

125 +

expect(compiled.errors[0]).toContain('Raw expression: v-if="a----"')

126 +

expect(compiled.errors[1]).toContain('Raw expression: {{ b++++ }}')

127 127

})

128 128

})

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4