Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
ace51c31
Commit
ace51c31
authored
3 years ago
by
Claire Bontempo
Browse files
Options
Download
Email Patches
Plain Diff
priortize adapter error over model error
parent
bc99b9fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ui/lib/core/addon/components/message-error.js
+16
-15
ui/lib/core/addon/components/message-error.js
with
16 additions
and
15 deletions
+16
-15
ui/lib/core/addon/components/message-error.js
+
16
-
15
View file @
ace51c31
...
...
@@ -11,7 +11,7 @@ import layout from '../templates/components/message-error';
* <MessageError @model={{model}} />
* ```
*
* @param model=null{DS.Model} - An Ember data model that will be used to bind error states
t
to the internal
* @param model=null{DS.Model} - An Ember data model that will be used to bind error states to the internal
* `errors` property.
* @param errors=null{Array} - An array of error strings to show.
* @param errorMessage=null{String} - An Error string to display.
...
...
@@ -24,34 +24,35 @@ export default Component.extend({
displayErrors
:
computed
(
'
errorMessage
'
,
'
model.{isError,adapterError.message,adapterError.errors.@each}
'
,
'
errors
'
,
'
errors.[]
'
,
'
model.adapterError.{errors.[],message}
'
,
'
model.isError
'
,
'
parentView.mountModel.{adapterError,isError}
'
,
function
()
{
const
errorMessage
=
this
.
errorMessage
;
const
errors
=
this
.
errors
;
const
modelIsError
=
this
.
model
?.
isError
;
if
(
errorMessage
)
{
return
[
errorMessage
];
}
if
(
errors
&&
errors
.
length
>
0
)
{
return
errors
;
}
const
modelIsError
=
this
.
model
?.
isError
||
this
.
parentView
?.
mountModel
.
isError
;
if
(
modelIsError
)
{
if
(
!
this
.
model
.
adapterError
)
{
let
adapterError
=
this
.
model
?.
adapterError
||
this
.
parentView
?.
mountModel
?.
adapterError
;
if
(
!
adapterError
)
{
return
;
}
if
(
this
.
model
.
adapterError
.
errors
.
length
>
0
)
{
return
this
.
model
.
adapterError
.
errors
.
map
((
e
)
=>
{
if
(
adapterError
.
errors
.
length
>
0
)
{
return
adapterError
.
errors
.
map
((
e
)
=>
{
if
(
typeof
e
===
'
object
'
)
return
e
.
title
||
e
.
message
||
JSON
.
stringify
(
e
);
return
e
;
});
}
return
[
this
.
model
.
adapterError
.
message
];
return
[
adapterError
.
message
];
}
if
(
errorMessage
)
{
return
[
errorMessage
];
}
if
(
errors
&&
errors
.
length
>
0
)
{
return
errors
;
}
return
'
no error
'
;
}
),
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment