adopted-ember-addons / adopted-ember-addons/ember-changeset

Type-Error thrown when a JSON-API server responds with a 406 error and an error body

Offen
#552 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
425
Forks
136
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Version

3.9.2

## Test Case

Sorry, don't have a test case for this

## Steps to reproduce

When saving a changeset, have a server respond with a 406 error response and the following body:
```
{
errors: [
{
title: 'Well excuse me',
detail: 'Error creating the thing you wanted.'
}
]
}
```

## Expected Behavior

I expect the Ember Data exception to be passed to my `catch()`rather than a type-error from ember-changeset

## Actual Behavior

ember-changeset throws a `TypeError`:

`TypeError: Cannot convert undefined or null to object`, and it is impossible to get the original error back from Ember Data. Instead, I have to pull all the information out of the `changeset.snapshot().changes` object, save them to the model manually, and save the model in order to get the Ember Data exception.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.