scribe
scribe copied to clipboard
[Feature request]: Make exception handling configurable
Scribe version
4.38.0
Your question
Motivation
If a model generation strategy fails, a warning is printed in the console:
⚠ Couldn't get example model for App\Models\Whatever via factoryCreate.
- This message can be hard to spot, since scribe's output is quite verbose.
- The only way to discover why the generation failed, is by running
scribe:generatewith xdebug, while having a breakpoint at https://github.com/knuckleswtf/scribe/blob/cb4c2e552fdae4fd2306e12bba60d5de38a9e4ad/src/Extracting/InstantiatesExampleModels.php#L56
Suggestions
- The message is printed with the same severity as something like
No bodyParameters() method found.... I think it would be appropriate to print it in red. - Add one or more configuration options for how these errors should be handled. Options could be something like:
a.
warn: (default, same as current behavior) b.dump: dump the exception to console, but continue execution c.fail: dump the exception to console, and abort with an exit code
Docs
- [X] I've checked the docs, the troubleshooting guide, and existing issues, but I didn't find a solution
Do you have an example of what Scribe's output looks like for you, so I can understand how verbose it is in context?
@shalvah sorry for the delay. Sure, here's an excerpt of the output where one of the factories fail:
This would be closed by https://github.com/knuckleswtf/scribe/pull/964
Sweet. Thanks!