topshelfcraft / canary Goto Github PK
View Code? Open in Web Editor NEWA friendlier, cleverer, more adorable error page for Craft CMS
License: Other
A friendlier, cleverer, more adorable error page for Craft CMS
License: Other
For errors in Twig templates, it'd be dope if the dev can open a code editor right from the error page, and Cmd-S to save, which writes the change to disk and reloads the page.
For classes/methods in Craft app files, link to the docs where appropriate.
(/admin/utilities/system-report
)
Projects that use the Canary package can add "Chirps" throughout their code, which are displayed in the Debug tab in chronological order, serving as "waypoints" in the code execution.
Canary::chirp("This is a message!", $someExtraInfo, $someOtherInfo)
For doDisplay
frames in compiled Twig template classes, display the source template path rather than the compiled template class path.
(Code snippet will still show the doDisplay
call from Template.php
.)
Maybe still show the compiled class name, in the meta pane? (Would anybody ever need it?)
Exceptions that implement CanaryException
contract can register Suggestions individually.
Additional SuggestionProvider
classes can be registered on the system via config.
Each SuggestionProvider has a chance to visit a caught exception, and optionally register Suggestions on it at runtime.
Shows only error & suggestion(s).
(Not stack frames, context, system vars, etc.)
ErrorHandler
Open questions:
Rather than just a dumb string, a Solution can also be an object, which encapsulates:
We had an issue with our 404 template not showing in production and on a whim I disabled Canary and the 404 template showed up again.
This is the behavior in production mode when a 404 fires:
I've added ./craft plugin/disable canary
to my production deploy script so I can keep it on in dev and test environments, but it would be great if it didn't do that!
(/admin/utilities/php-info
)
Inspiration from Laravel Ignition:
https://github.com/facade/ignition/tree/master/src/SolutionProviders
Global function to "dump, die, and debug" โ
Will require a DumpDieDebug
Exception. We should give special treatment to that Exception class in the handler, whereby instead of showing the typical error/code frame for the actual ddd()
call, we show the dump instead (using Symfony VarDumper?).
Should take variable number of args โ ddd($thing1, $thing2, ...)
Suggestions can register an invokable Solution class.
Only admins, in dev mode, can invoke Solutions.
The Solution accepts the Exception and invoking Suggestion as dependencies for context.
If a frame is from a Twig template (i.e. the file is in storage/runtime/compiled_templates
):
Exceptions can:
If Canary encounters an exception that implements FriendlyExceptionInterface
it should add the result of getSolution
as a Suggestion.
Your plugin is such a nice way to handle errors. Can we get a Craft 4 version?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.