FIX: `Ember.warn` needs an `id`

This way errors can be customized/silenced in the console.
This commit is contained in:
Robin Ward 2019-01-16 14:53:13 -05:00
parent 98f26bcaf5
commit 16a7102dad
4 changed files with 10 additions and 5 deletions

View File

@ -101,7 +101,7 @@ export default Ember.Mixin.create({
_save() { _save() {
Ember.warn("You should define a `_save` method", { Ember.warn("You should define a `_save` method", {
id: "admin.mixins.setting-component" id: "discourse.setting-component.missing-save"
}); });
return Ember.RSVP.resolve(); return Ember.RSVP.resolve();
}, },

View File

@ -19,7 +19,9 @@ const Mixin = {
export function bufferedRender(obj) { export function bufferedRender(obj) {
if (!obj.buildBuffer) { if (!obj.buildBuffer) {
Ember.warn("Missing `buildBuffer` method"); Ember.warn("Missing `buildBuffer` method", {
id: "discourse.buffered-render.missing-build-buffer"
});
return obj; return obj;
} }

View File

@ -9,7 +9,9 @@ export default Ember.Mixin.create({
uploadProgress: 0, uploadProgress: 0,
uploadDone() { uploadDone() {
Ember.warn("You should implement `uploadDone`"); Ember.warn("You should implement `uploadDone`", {
id: "discourse.upload.missing-upload-done"
});
}, },
validateUploadedFilesOptions() { validateUploadedFilesOptions() {

View File

@ -24,7 +24,9 @@ const RestModel = Ember.Object.extend({
const payload = self.__munge(res.payload || res.responseJson); const payload = self.__munge(res.payload || res.responseJson);
if (payload.success === "OK") { if (payload.success === "OK") {
Ember.warn("An update call should return the updated attributes"); Ember.warn("An update call should return the updated attributes", {
id: "discourse.rest-model.update-attributes"
});
res = props; res = props;
} }
@ -97,7 +99,6 @@ RestModel.reopenClass({
args = args || {}; args = args || {};
if (!args.store) { if (!args.store) {
const container = Discourse.__container__; const container = Discourse.__container__;
// Ember.warn('Use `store.createRecord` to create records instead of `.create()`');
args.store = container.lookup("service:store"); args.store = container.lookup("service:store");
} }