novu icon indicating copy to clipboard operation
novu copied to clipboard

fix: add try catch condition in handlebar template compilation

Open jainpawan21 opened this issue 2 years ago • 6 comments

What change does this PR introduce?

Add try catch condition for handlebars template compilation Add new detail enum value

Why was this change needed?

Closes #2229

Other information (Screenshots)

Screenshot 2022-12-19 at 5 37 47 PM

jainpawan21 avatar Dec 19 '22 12:12 jainpawan21

Fix @scopsy comments and I think it is ready to merge :)

davidsoderberg avatar Dec 20 '22 16:12 davidsoderberg

@scopsy shifted try catch one level above and added handlebar error in execution details Screenshot 2022-12-27 at 6 40 29 PM

jainpawan21 avatar Dec 27 '22 13:12 jainpawan21

Hi @jainpawan21 , correct me if I'm wrong, but this still won't apply to the other channels, right? Like sms, in app, push etc

ainouzgali avatar Dec 27 '22 14:12 ainouzgali

Hi @jainpawan21 , correct me if I'm wrong, but this still won't apply to the other channels, right? Like sms, in app, push etc

Yes, You are right, it will handle only email syntax error

jainpawan21 avatar Dec 27 '22 14:12 jainpawan21

I've actually been working on something similar before I noticed your PR 🙈 Would you mind if I join you on this one and push some of my changes? @jainpawan21

ainouzgali avatar Dec 28 '22 11:12 ainouzgali

I've actually been working on something similar before I noticed your PR 🙈 Would you mind if I join you on this one and push some of my changes? @jainpawan21

Yes sure Gali

jainpawan21 avatar Dec 28 '22 12:12 jainpawan21

@jainpawan21 I added the try catch to also be on the first render&compile (not only on the html). And also to wrap the compiles for subject, preheader, cta etc . Also changed it for all channels. Pawan, please let me know what you think :)

ainouzgali avatar Jan 02 '23 12:01 ainouzgali

@ainouzgali what do you think also adding a validation on the client side? So we can even skip the server request if the compile message fails on the client?

scopsy avatar Jan 02 '23 16:01 scopsy

@scopsy Yes, I definitely want that. I've started looking into that, but it is not as straight forward. I will continue at the next cool down. Or, we could open it for the community, in case someone will be available to help on this.
Also. I wouldn't do it on the client, but rather on save/update of template.

ainouzgali avatar Jan 02 '23 16:01 ainouzgali