-
Notifications
You must be signed in to change notification settings - Fork 23
Custom error hook #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you. You have interesting trouble :-) Can you send me how Blade map errors from compiled template to original file? Thank you |
I just had an idea about it, because there is a package https://github.com/facade/ignition which does that. If you have an error in Blade, it shows on Error 500 the original line and a file. I was thinking if it would be possible to hook it into this tool. However, it can be challenging. Step 1: Requires no additional packages: Step 2 (maybe impossible) Requires the Blade compiler: Edit: I tried to dig deeper and I found this: BladeSourceMapCompiler.php which is doing it. |
I mean that support for this concrete library is not good idea. What about universal callback? Something like:
Structure for
What do you mean? Can it solve your trouble? I think about universal solution. Solution for extend in future. |
Looks great, I never thought about implementing any library directly. Some universal hook like you are suggesting is the correct way I think. So yes, I agree. Thank you Just some ideas about your approach
|
I am sorry, I was mean that you can add it into tool :-)
|
Sorry, I'm confused now a little bit. You want me to add this custom callback option into codebase via Pull Request? I can do this. Or which tool you meant? About that config possibility, I thought something like this. Similar approach using FTP Deployment. class FailedBladeCallback implements \JakubOnderka\FailCallback` {
public function say($inputFromPhpParallelLint) : something {
...
}
}
return [
'paths' => ['./app', './storage/framework/views', './bootstrap/app.php'],
'json_output' => true,
'fail_callback' => new FailedBladeCallback,
]; |
When do you have a time, please send PR - draft. Together we can improve it :-) Config - this is second problem, when you can add it, please send another PR. Config file and parameters can be compatible like PHPStan tool, etc. |
Thank you for keeping this tool alive, it is amazing! But I would like to propose a custom error hook or some callback which I can use to modify error before proceeding. This is the reason
Laravel & Blade
Laravel FW uses Blade as a template, which is then compiled into PHP files. So I'm running this code
php artisan view:cache # Compile all Blade templates ./vendor/bin/parallel-lint ./storage/framework/views
But if there is an error in Blade template, it shows error like this:
Parse error: ./storage/framework/views/b89d10e4ca8386fb9f234e0b5a62798e71014114.php:66
Which says nothing, because it points into already compiled. However, there is a way how to map this error back into the original Blade file.So if there would be some possible callbacks, I would use it to modify error back to the original file and line.
Is there a way how to make this possible? It would maybe require some config file instead of CLI arguments only. If you don't want to require any other package for config parsing (like Yaml etc), maybe just include PHP file with an array.
The text was updated successfully, but these errors were encountered: