open-nomad/ui/app/utils/codes-for-error.js
Michael Lange 4a35f3c5a5 Handle 403s gracefully
- When a list 403s, treat it as if it were empty
- When a single resource 403s, redirect to an application error page
  that has a backdoor link to the tokens page
2017-10-12 17:40:49 -07:00

16 lines
322 B
JavaScript

// 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) {
error.errors.forEach(err => {
codes.push(err.status);
});
}
return codes
.compact()
.uniq()
.map(code => '' + code);
}