error! method with Grape Entity and Multiple errors
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
On the current implementation we're using with: inside the Hash. By the way, on the documentation the current Grape Entity for API::Error needs a code: to work.
error!({ message: 'Unauthorized', with: API::Error }, 408)
So, what about create a third optional param? something like that:
error!({ message: 'Unauthorized', code: 408 }, 408, with: API::Error)
By the way, how we can create multiple errors and group all?
ex:
{
"errors": [
{
"message": "Sorry, that page does not exist",
"code": 34
},
{
"message": "Sorry, that page does not exist 2",
"code": 25
}
]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the current error! implementation and the documentation example for API::Error, especially the required code: field. Compare the proposed optional with: argument and grouped errors response with existing behavior; done means the intended API is specified and both cases are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100