diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-07-01 15:44:04 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-07-31 10:27:15 +0200 |
commit | 91e3c88d8f6428d41326869bbd8f6ece99145627 (patch) | |
tree | 76308a10c6de2e7fd4c1ba63924a261197a74370 /askama_derive/src/generator.rs | |
parent | 8b184511edff62bd3786be3f5d62c1965430278b (diff) | |
download | askama-91e3c88d8f6428d41326869bbd8f6ece99145627.tar.gz askama-91e3c88d8f6428d41326869bbd8f6ece99145627.tar.bz2 askama-91e3c88d8f6428d41326869bbd8f6ece99145627.zip |
derive: define separate ParseError type
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/generator.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index f8b9ecb..f17b6f6 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -259,7 +259,11 @@ mod _parsed { // internally we will transmute it to `&'static str` to satisfy the compiler. // However, we only expose the nodes with a lifetime limited to `self`. let src = unsafe { mem::transmute::<&str, &'static str>(source.as_str()) }; - let nodes = parse(src, syntax)?; + let nodes = match parse(src, syntax) { + Ok(nodes) => nodes, + Err(e) => return Err(e.to_string().into()), + }; + Ok(Self { source, nodes }) } |