2017-10-13 00:40:49 +00:00
|
|
|
// Returns an array of error codes as strings for an Ember error object
|
|
|
|
export default function codesForError(error) {
|
|
|
|
const codes = [error.code];
|
|
|
|
|
|
|
|
if (error.errors) {
|
2021-12-28 14:45:20 +00:00
|
|
|
error.errors.forEach((err) => {
|
2017-10-13 00:40:49 +00:00
|
|
|
codes.push(err.status);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return codes
|
|
|
|
.compact()
|
|
|
|
.uniq()
|
2021-12-28 14:45:20 +00:00
|
|
|
.map((code) => '' + code);
|
2017-10-13 00:40:49 +00:00
|
|
|
}
|