PerlDancer / PerlDancer/Dancer2

Allow send_error to send different content types

Open
#1,344 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

In applications where there are routes outputting json and html functions like send_as make that work without too much of a problem. send_error appears to have all the logic to deal with a serializer, but it could do with a way of asking for a different one so that errors come out in a consistent format with the rest of the request rather than what the global application is configured for.

It looks relatively simple to implement assuming a reasonable syntax can be agreed upon for the helper. I'd be willing to create a pull request but I figured it was best to check it wasn't going to get shot down before doing so.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing send_error and send_as helpers, focusing on how send_error selects and invokes serializers. Clarify the helper syntax and verify that errors can select a serializer matching the rest of the request rather than the global application setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.