DS.TimeoutError

DS.TimeoutError Class

Defined in: addon/adapters/errors.js:182

Module: ember-data

A DS.TimeoutError is used by an adapter to signal that a request to the external API has timed out. I.e. no response was received from the external API within an allowed time period.

An example use case would be to warn the user to check their internet connection if an adapter operation has timed out:

app/routes/application.js
import Ember from 'ember';
import DS from 'ember-data';

const { TimeoutError } = DS;

export default Ember.Route.extend({
  actions: {
    error(error, transition) {
      if (error instanceof TimeoutError) {
        // alert the user
        alert('Are you still connected to the internet?');
        return;
      }

      // ...other error handling logic
    }
  }
});

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/data/classes/DS.TimeoutError.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部