save last error in the ctx