question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Related to #13, I’m going to fork this library to add in proper error object support in order to conform with JSON API’s standards on throwing errors.

Anything in particular I should be aware of/attempt to implement while I’m at it?

I’m not planning on parsing error codes and such within jsonapi-serializer - just properly handling a supplied error object. My biggest question is whether I should add an err (like JSONAPISerializer(type, data, opts, err)) or magically parse a supplied error type, or include it in opts ala meta, or something else? (Could also add a JSONAPISerializer.error(type, data, opts)).

I know part of the goal with jsonapi-serializer is to be as agnostic as possible and I plan on submitting a PR when I’m done so any thoughts on best practices as I work on this would be appreciated. 😃

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
john-goldsmithcommented, Jun 3, 2016

Any updates here?

1reaction
brettneesecommented, Nov 2, 2015

Since per jsonapi standards, you cannot have a response with both a “data” and “errors” object, I decided to magically treat any supplied “error” or “errors” collection/resource as an error and parse it from there, so you can just JSONApiSerializer('error', errorData, opts) and it will spit out the appropriate response.

I haven’t finished implementing all the opts yet (only meta and topLevelLinks – I’m currently just doing payload.errors.push(records) instead of something like ErrorSerliazerUtils().) When I get that done, I’ll do a PR, but it might be a few more days because we actually don’t need any of the other options. https://github.com/brettneese/jsonapi-serializer

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Error Handling? - Definition from Techopedia
Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the...
Read more >
What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
Read more >
Exception handling - Wikipedia
In computing and computer programming, exception handling is the process of responding to the occurrence of exceptions – anomalous or exceptional conditions ...
Read more >
How to implement complete error handling? - Codegrip
Error handling is when your software is capable to counter or confiscate errors that may have been brought on by a programmer mistake...
Read more >
Error handling - Express.js
Error Handling refers to how Express catches and processes errors that occur both synchronously and asynchronously. Express comes with a default error ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found