Skip to content

Conversation

@begedin
Copy link
Contributor

@begedin begedin commented Mar 11, 2016

This will close #85 and possibly #28 and #29

The phantomjs installation ember-cli includes in its locally installed npm package somehow got corrupted on my end, causing the browser to crash while running tests.

To get around it, I deleted the node_modules folder and re-ran npm install. I'm guessing some components got updated this way, due to how we specify our versions, so as a result, the default message an AdapterError contains changed, causing tests to fail.

Since we already talked about formatting errors such as that one in a nicer way, I decided to quickly implement an error formatter component, to use in place of these basic errors.

An adapter error looks like something along the lines of

errors: [
  // contains errors returned by the API. In case of validation errors, there will be multiple
  // in case of a generic error, there will usually be just one object
  { 
    id: 'ERROR_ID'
    title: 'Error title',
    detail: 'error detail', },
    status: 404 // status code,
    // this last one is only for validation errors
    source: { pointer: 'data/attributes/field_with_validation_error' }
  }
],
message: 'Some sort of standard error message goes here'
// there are other properties here to, but of no concern to us at the moment

For each error in the errors array, the component will output a

<p class="error">{{error.title}}: {{error.message}}</p>

I think that's sufficient for now, but we will be able to modify this behavior as we please in the future.

@begedin
Copy link
Contributor Author

begedin commented Mar 11, 2016

@joshsmith The tests actually failed on CircleCI as well, with the same PhantomJS crashing issue. I had to "rebuild without cache" to get them to run.

We may have a different problem here, but I'm not sure what it could be.

@begedin begedin mentioned this pull request Mar 17, 2016
joshsmith added a commit that referenced this pull request Mar 17, 2016
Add error-formatter component to parse and display adapter errors
@joshsmith joshsmith merged commit 79a8783 into develop Mar 17, 2016
@joshsmith joshsmith deleted the error-formatter-component branch March 17, 2016 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Friendlier errors on post creation

3 participants