The advantage of raising an error is that the application can deal with the situation in whatever way seems fit (by registering a special error handler or by simply using "ignore" or "replace").
I agree that much of this lies outside the scope of codecs and should be handled at an application or protocol level.—M.-A.