Gradient catastrophe in the solution of nonconservative hyperbolic systems