github.com/hernad/nomad@v1.6.112/ui/app/utils/codes-for-error.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 // Returns an array of error codes as strings for an Ember error object 7 export default function codesForError(error) { 8 const codes = [error.code]; 9 10 if (error.errors) { 11 error.errors.forEach((err) => { 12 codes.push(err.status); 13 }); 14 } 15 16 return codes 17 .compact() 18 .uniq() 19 .map((code) => '' + code); 20 }