Add pipeline error template to sample, and add a missing license header

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
A bit more comment

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
Refactor to avoid duplications

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>