Serialize errors properly.