open-nomad/ui/app/adapters/namespace.js
2023-04-10 15:36:59 +00:00

21 lines
521 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Watchable from './watchable';
import codesForError from '../utils/codes-for-error';
import classic from 'ember-classic-decorator';
@classic
export default class NamespaceAdapter extends Watchable {
findRecord(store, modelClass, id) {
return super.findRecord(...arguments).catch((error) => {
const errorCodes = codesForError(error);
if (errorCodes.includes('501')) {
return { Name: id };
}
});
}
}