diff --git a/.changeset/hip-actors-hide.md b/.changeset/hip-actors-hide.md new file mode 100644 index 000000000..487ce1dc8 --- /dev/null +++ b/.changeset/hip-actors-hide.md @@ -0,0 +1,5 @@ +--- +"ember-resources": patch +--- + +when using RemoteData, isError should be true when the http status code is >= 400. Resolves #825" diff --git a/ember-resources/src/util/remote-data.ts b/ember-resources/src/util/remote-data.ts index ddb1dd387..ffe033892 100644 --- a/ember-resources/src/util/remote-data.ts +++ b/ember-resources/src/util/remote-data.ts @@ -67,9 +67,13 @@ export class State { /** * true if the request throws an exception + * or if the request.status is >= 400 */ get isError() { - return this.isRejected; + let httpError = this.status && this.status >= 400; + let promiseThrew = this.isRejected; + + return httpError || promiseThrew; } }