home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
2.18
  • Packages
    • ember-data
  • Classes
    • DS.AbortError
    • DS.Adapter
    • DS.AdapterError
    • DS.AdapterPopulatedRecordArray
    • DS.BelongsToReference
    • DS.BooleanTransform
    • DS.BuildURLMixin
    • DS.ConflictError
    • DS.DateTransform
    • DS.EmbeddedRecordsMixin
    • DS.Errors
    • DS.FilteredRecordArray
    • DS.ForbiddenError
    • DS.HasManyReference
    • DS.InvalidError
    • DS.JSONAPIAdapter
    • DS.JSONAPISerializer
    • DS.JSONSerializer
    • DS.ManyArray
    • DS.Model
    • DS.NotFoundError
    • DS.NumberTransform
    • DS.PromiseArray
    • DS.PromiseManyArray
    • DS.PromiseObject
    • DS.RESTAdapter
    • DS.RESTSerializer
    • DS.RecordArray
    • DS.RecordReference
    • DS.RootState
    • DS.Serializer
    • DS.ServerError
    • DS.Store
    • DS.StringTransform
    • DS.TimeoutError
    • DS.Transform
    • DS.UnauthorizedError
    • Ember.Inflector

Class DS.NotFoundError


Defined in: addon/-private/adapters/errors.js:265
Module: ember-data

A DS.NotFoundError equates to a HTTP 404 Not Found response status. It is used by an adapter to signal that a request to the external API was rejected because the resource could not be found on the API.

An example use case would be to detect if the user has entered a route for a specific model that does not exist. For example:

app/routes/post.js
import Route from '@ember/routing/route';
import DS from 'ember-data';

const { NotFoundError } = DS;

export default Route.extend({
  model(params) {
    return this.get('store').findRecord('post', params.post_id);
  },

  actions: {
    error(error, transition) {
      if (error instanceof NotFoundError) {
        // redirect to a list of all posts instead
        this.transitionTo('posts');
      } else {
        // otherwise let the error bubble
        return true;
      }
    }
  }
});


On this page

Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2025 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue Created with Sketch.