File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/PatternLab/PatternEngine/Twig/Loaders Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,16 @@ public function __construct($options = array()) {
116
116
*/
117
117
public function render ($ options = array ()) {
118
118
119
- return $ this ->instance ->render ($ options ["pattern " ], $ options ["data " ]);
119
+ $ result = $ this ->instance ->render ($ options ["pattern " ], $ options ["data " ]);
120
+ // This error handler catches files that didn't render using any of the loaders.
121
+ // The most common scenario is when a file's contents get passed to and through `Twig_Loader_String` and
122
+ // outputs the raw Twig file contents like `@atoms/buttons/button.twig`.
123
+ // @todo Remove this once `Twig_Loader_String` is removed.
124
+ if (strpos ($ result , "@ " ) === 0 ) {
125
+ throw new \Twig_Error_Loader ("Twig file not found: " . $ result . "\n" );
126
+ } else {
127
+ return $ result ;
128
+ }
120
129
121
130
}
122
131
You can’t perform that action at this time.
0 commit comments