mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improve data errors for twig
This commit is contained in:
parent
b707671cd8
commit
620bd18cf9
@ -298,6 +298,9 @@ class PreviewController extends BaseController
|
|||||||
->mock();
|
->mock();
|
||||||
} catch(SyntaxError $e) {
|
} catch(SyntaxError $e) {
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
return response()->json(['message' => 'invalid data access', 'errors' => ['design.design.body' => $e->getMessage()]], 422);
|
||||||
|
}
|
||||||
|
|
||||||
if (request()->query('html') == 'true') {
|
if (request()->query('html') == 'true') {
|
||||||
return $ts->getHtml();
|
return $ts->getHtml();
|
||||||
|
@ -31,12 +31,8 @@ class TwigLint implements ValidationRule
|
|||||||
try {
|
try {
|
||||||
$twig->parse($twig->tokenize(new \Twig\Source(preg_replace('/<!--.*?-->/s', '', $value), '')));
|
$twig->parse($twig->tokenize(new \Twig\Source(preg_replace('/<!--.*?-->/s', '', $value), '')));
|
||||||
} catch (\Twig\Error\SyntaxError $e) {
|
} catch (\Twig\Error\SyntaxError $e) {
|
||||||
// echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
|
||||||
nlog($e->getMessage());
|
|
||||||
$fail($e->getMessage());
|
$fail($e->getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -482,6 +482,8 @@ class TemplateService
|
|||||||
default => $processed = [],
|
default => $processed = [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nlog(json_encode($processed));
|
||||||
|
|
||||||
return $processed;
|
return $processed;
|
||||||
|
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user