bigpresh / bigpresh/Dancer-Plugin-Database

Convenience functions break stacktrace

Open
#51 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
39
Forks
36
PR merge metrics
No merged PRs in 30d

Description

When an error occurs while using any of convenience functions like quick_select, Dancer is not able to produce a usable stack trace. The error is shown to be originating always from the same line of code in the Database::Handle module. I.e. where that actual call to DBI is made.

Apparently, this has something to do with Carp not being able to track inheritance from DBI correctly.

Update: Upon looking through DBI internals, it seems that DBI implements Carp.pm-like functionality on its own which does not work exactly the same. That's why it is impossible to fix this problem adjusting variables like @CARP_NOT, $CarpLevel in Carp.pm. When an error occurs during SQL statement execution, DBI looks down the calling chain and finds the first module outside of DBI or DBD namespace and reports this module in its error message. Even if this module is a subclass of DBI.
So, the only solution would be to catch and rethrow the error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the convenience functions, including quick_select, into the Database::Handle module and inspect how DBI reports SQL execution errors. Confirm how errors are propagated through DBI and define done as producing a stack trace that identifies the original caller rather than the shared DBI call line.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
databases
Issue type
Bug
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.